Fix relation for Ad_banner and Ad_image
Update site.rake for New UI
This commit is contained in:
parent
43cf6b70b7
commit
792785f7ba
|
@ -22,8 +22,10 @@ class Admin::AdImagesController < Admin::AdBannersController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@ad_image = AdImage.find(params[:id])
|
@ad_banner = AdBanner.find params[:ad_banner][:id]
|
||||||
|
@ad_image = AdImage.find(params[:ad_image][:id])
|
||||||
@ad_image.update_attributes(params[:ad_image])
|
@ad_image.update_attributes(params[:ad_image])
|
||||||
|
@ad_banner.ad_images << @ad_image
|
||||||
redirect_to admin_ad_images_path
|
redirect_to admin_ad_images_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -38,10 +40,10 @@ class Admin::AdImagesController < Admin::AdBannersController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
# @ad_banner = AdBanner.find params[:ad_banner][:id]
|
@ad_banner = AdBanner.find params[:ad_banner][:id]
|
||||||
@ad_image = AdImage.new params[:ad_image]
|
@ad_image = AdImage.new params[:ad_image]
|
||||||
#@ad_image.to_save = true
|
@ad_image.to_save = true
|
||||||
#@ad_banner.ad_images << ad_image
|
@ad_banner.ad_images << @ad_image
|
||||||
|
|
||||||
if @ad_image.save
|
if @ad_image.save
|
||||||
redirect_to admin_ad_images_path
|
redirect_to admin_ad_images_path
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted">Banner</label>
|
<label class="control-label muted">Banner</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= select_tag 'ad_banner[id]',options_from_collection_for_select(AdBanner.all, "id", "title",params[:ad_banner_id]) , :class=>"input-medium" %>
|
<%= select_tag 'ad_banner[id]',options_from_collection_for_select(AdBanner.all, "id", "title", @ad_image.ad_banner_id) , :class=>"input-medium" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -244,6 +244,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Form Actions -->
|
<!-- Form Actions -->
|
||||||
|
<%= f.hidden_field :id, :value => @ad_image.id %>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<%= f.submit t("submit"),:class=>"btn btn-primary" %>
|
<%= f.submit t("submit"),:class=>"btn btn-primary" %>
|
||||||
<%= f.submit t("cancel"),:class=>"btn ",:type => 'reset' %>
|
<%= f.submit t("cancel"),:class=>"btn ",:type => 'reset' %>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<% node = Item.root %>
|
<% node = Item.root %>
|
||||||
|
<% unless node.nil? %>
|
||||||
<ol id='<%= node.id %>' class="sortable item-groups">
|
<ol id='<%= node.id %>' class="sortable item-groups">
|
||||||
<%= render 'node_and_children', node: node %>
|
<%= render 'node_and_children', node: node %>
|
||||||
</ol>
|
</ol>
|
||||||
|
<% end %>
|
||||||
<%= render 'layouts/delete_modal', delete_options: {remote: true} %>
|
<%= render 'layouts/delete_modal', delete_options: {remote: true} %>
|
||||||
|
|
||||||
<%= javascript_include_tag "lib/jquery.pageslide.js" %>
|
<%= javascript_include_tag "lib/jquery.pageslide.js" %>
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace :site do
|
||||||
site.design = design
|
site.design = design
|
||||||
site.save
|
site.save
|
||||||
theme = design.themes.first
|
theme = design.themes.first
|
||||||
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id )
|
home = Page.new( :design_id => design.id, :name => 'home', :is_published => true, :theme_id => theme.id, :menu_enabled_for => [] )
|
||||||
|
|
||||||
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
home.title_translations = {"zh_tw"=>"首頁", "en"=>"Home"}
|
||||||
home.save
|
home.save
|
||||||
|
|
Loading…
Reference in New Issue