Sha256: 995f59c60a11dbf4830301c4c32a1bb5c135533a4e34dcdbe52d4842b272166c

Contents?: true

Size: 1.68 KB

Versions: 21

Compression:

Stored size: 1.68 KB

Contents

=begin
  Camaleon CMS is a content management system
  Copyright (C) 2015 by Owen Peredo Diaz
  Email: owenperedo@gmail.com
  This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the  GNU Affero General Public License (GPLv3) for more details.
=end
class Admin::Appearances::Widgets::AssignController < Admin::AppearancesController
  before_action :check_permission_role
  def new
    @sidebar = current_site.sidebars.find(params[:sidebar_id])
    @widget = current_site.widgets.find(params[:widget_id])
    @assigned = @sidebar.assigned.create!({title: "Default", widget_id: @widget.id})
    render partial: "form", locals: {assigned: @assigned, widget: @widget, sidebar: @sidebar}, layout: "admin/ajax"
  end

  def update
    @sidebar = current_site.sidebars.find(params[:sidebar_id])
    @assigned = @sidebar.assigned.find(params[:id])
    if @assigned.update(params[:assign])
      @assigned.set_field_values(params[:field_options])
      flash[:notice] = "Widget assign updated"
    else
      flash[:error] = "Widget assign not updated"
    end
    redirect_to admin_appearances_widgets_main_index_path
  end

  def destroy
    current_site.sidebars.find(params[:sidebar_id]).assigned.find(params[:id]).destroy
    render inline: ''
  end

  private
  def check_permission_role
    authorize! :manager, :widgets
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
camaleon_cms-1.0.8 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-1.0.7 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-1.0.6 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-1.0.5 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-1.0.4 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-1.0.3 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-1.0.2 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-1.0.1 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-1.0 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-0.2.1 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-0.2.0 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-0.1.9 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-0.1.8 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-0.1.7 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-0.1.6 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-0.1.5 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-0.1.4 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-0.1.3 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-0.1.2 app/controllers/admin/appearances/widgets/assign_controller.rb
camaleon_cms-0.0.2 app/controllers/admin/appearances/widgets/assign_controller.rb