mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
done with creating relationship and generating view for venue_commercials
This commit is contained in:
parent
dc0da8c500
commit
7bbb0da17a
2 changed files with 29 additions and 22 deletions
|
|
@ -3,6 +3,7 @@ module Admin
|
|||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :venue ,through: :conference, singelton: true
|
||||
before_action :set_venue
|
||||
before_action :set_commercial , only: [:update , :destroy]
|
||||
|
||||
def create
|
||||
@commercial = @venue.build_commercial(commercial_params)
|
||||
|
|
@ -54,5 +55,9 @@ module Admin
|
|||
def set_venue
|
||||
@venue = @conference.venue
|
||||
end
|
||||
|
||||
def set_commercial
|
||||
@commercial = Commercial.find params[:id]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,32 +22,34 @@
|
|||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||
|
||||
#commercials-content.tab-pane
|
||||
- if @venue
|
||||
.row
|
||||
.col-md-6
|
||||
#resource-content
|
||||
#resource-placeholder{ style: 'background-color:#d3d3d3; float: left; width: 400px; height: 250px; margin: 5px; border-width: 1px; border-style: solid; border-color: rgba(0,0,0,.2);' }
|
||||
.row
|
||||
.col-md-6
|
||||
= semantic_form_for(@venue.create_commercial,as: :commercial, url: admin_conference_venue_venue_commercial_path(conference_id: @conference.short_title)) do |f|
|
||||
= f.input :url, label: 'URL', as: :string, input_html: { required: 'required', type: 'url' },
|
||||
hint: 'Just paste the url of your video/photo provider. Currently supported: YouTube, Vimeo, SpeakerDeck, SlideShare, Instagram, Flickr.'
|
||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true }
|
||||
%hr
|
||||
- @venue.commercial do |commercial|
|
||||
- if commercial.persisted?
|
||||
- if can? :create, @venue.commercial
|
||||
- if @venue.commercial
|
||||
- if @venue.commercial.persisted?
|
||||
.col-md-4
|
||||
.thumbnail
|
||||
.flexvideo{ id: "resource-content-#{commercial.id}"}
|
||||
= render partial: 'shared/media_item', locals: { commercial: commercial }
|
||||
.flexvideo{ id: "resource-content-#{@venue.commercial.id}"}
|
||||
= render partial: 'shared/media_item', locals: { commercial: @venue.commercial }
|
||||
.caption
|
||||
- if can? :update, commercial
|
||||
= semantic_form_for commercial, url: admin_conference_venue_venue_commercial_path(conference_id: @conference.short_title, id: commercial.id) do |f|
|
||||
= f.input :url, label: 'URL', as: :string, input_html: { id: "commercial_url_#{commercial.id}", required: 'required' }, hint: 'Just paste the url of your video/photo provider'
|
||||
- if can? :update, @venue.commercial
|
||||
= semantic_form_for @venue.commercial, as: :commercial, url: admin_conference_venue_venue_commercial_path(conference_id: @conference.short_title, id: @venue.commercial.id) do |f|
|
||||
= f.input :url, label: 'URL', as: :string, input_html: { id: "commercial_url_#{@venue.commercial.id}", required: 'required' }, hint: 'Just paste the url of your video/photo provider'
|
||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-success' }, label: 'Update'
|
||||
- if can? :destroy, commercial
|
||||
= link_to 'Delete', admin_conference_venue_venue_commercial_path(@conference.short_title, commercial.id),
|
||||
- if can? :destroy, @venue.commercial
|
||||
= link_to 'Delete', admin_conference_venue_venue_commercial_path(conference_id: @conference.short_title, id: @venue.commercial.id),
|
||||
method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger'
|
||||
%hr
|
||||
%hr
|
||||
- else
|
||||
.row
|
||||
.col-md-6
|
||||
#resource-content
|
||||
#resource-placeholder{ style: 'background-color:#d3d3d3; float: left; width: 400px; height: 250px; margin: 5px; border-width: 1px; border-style: solid; border-color: rgba(0,0,0,.2);' }
|
||||
.row
|
||||
.col-md-6
|
||||
= semantic_form_for(Commercial.new,as: :commercial, url: admin_conference_venue_venue_commercial_path(conference_id: @conference.short_title)) do |f|
|
||||
= f.input :url, label: 'URL', as: :string, input_html: { required: 'required', type: 'url' },
|
||||
hint: 'Just paste the url of your video/photo provider. Currently supported: YouTube, Vimeo, SpeakerDeck, SlideShare, Instagram, Flickr.'
|
||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary pull-right', disabled: true }
|
||||
%hr
|
||||
|
||||
- else
|
||||
hint: 'First Create Venue, then update commercial'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue