Class: Workarea::Admin::ReleasesController

Inherits:
ApplicationController show all
Includes:
StorefrontHelper
Defined in:
app/controllers/workarea/admin/releases_controller.rb

Instance Method Summary collapse

Methods included from StorefrontHelper

#storefront

Methods inherited from ApplicationController

#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model

Methods included from Publishing

#allow_publishing!, #allow_publishing?, #set_publishing_options

Methods included from Visiting

#most_visited

Instance Method Details

#calendar_feedObject



66
67
68
69
70
# File 'app/controllers/workarea/admin/releases_controller.rb', line 66

def calendar_feed
  send_data ReleasesFeedViewModel.wrap(nil).to_ical,
            filename: params[:filename],
            type: 'text/calendar'
end

#createObject



23
24
25
26
27
# File 'app/controllers/workarea/admin/releases_controller.rb', line 23

def create
  @release.attributes = params[:release]
  @release.save
  render json: { release: @release.model }
end

#destroyObject



58
59
60
61
62
63
64
# File 'app/controllers/workarea/admin/releases_controller.rb', line 58

def destroy
  self.current_release = nil
  @release.destroy

  flash[:success] = t('workarea.admin.releases.flash_messages.removed')
  redirect_to releases_path
end

#editObject



20
21
# File 'app/controllers/workarea/admin/releases_controller.rb', line 20

def edit
end

#indexObject



14
15
# File 'app/controllers/workarea/admin/releases_controller.rb', line 14

def index
end

#listObject



29
30
31
32
# File 'app/controllers/workarea/admin/releases_controller.rb', line 29

def list
  search = Search::AdminReleases.new(params)
  @search = Admin::ReleaseSearchViewModel.new(search, view_model_options)
end

#newObject



34
35
# File 'app/controllers/workarea/admin/releases_controller.rb', line 34

def new
end

#originalObject



47
48
# File 'app/controllers/workarea/admin/releases_controller.rb', line 47

def original
end

#publishObject



50
51
52
53
54
55
56
# File 'app/controllers/workarea/admin/releases_controller.rb', line 50

def publish
  self.current_release = nil
  PublishRelease.perform_async(@release.id)

  flash[:success] = t('workarea.admin.releases.flash_messages.published')
  redirect_to return_to || release_path(@release)
end

#showObject



17
18
# File 'app/controllers/workarea/admin/releases_controller.rb', line 17

def show
end

#updateObject



37
38
39
40
41
42
43
44
45
# File 'app/controllers/workarea/admin/releases_controller.rb', line 37

def update
  if @release.update_attributes(params[:release])
    flash[:success] = t('workarea.admin.releases.flash_messages.saved')
    redirect_to release_path(@release)
  else
    flash[:error] = t('workarea.admin.releases.flash_messages.saved_error')
    render :edit
  end
end