Skip to content

Commit

Permalink
Created migration: @RemoveSectionSettings@ and updated views.
Browse files Browse the repository at this point in the history
  • Loading branch information
hulihanapplications committed May 21, 2012
1 parent d48c44f commit 4a9b698
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/layout.css.scss
Expand Up @@ -25,7 +25,7 @@ a.extra_options {padding:7px 0px;display:block;border-top:1px solid #ccc;}
height:95px;
background:url(bgs/main_logo_bg.png) no-repeat;
background-position:bottom left;
border-top:1px solid #aaa;
// border-top:1px solid #aaa;
}
#wrapper > #content {
height:100%;
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/_menu.html.erb
Expand Up @@ -7,7 +7,7 @@
<%= link_to(icon("items") + " " + Item.model_name.human(:count => :other), {:action => "all_items", :controller => "items"}, :class => params[:action] == "all_items" ? :selected : nil ) %>
<%#= render :partial => "items/all_items_menu" %>
<%= render :partial => "items/menu" %>
<% end if @setting[:section_items] %>
<% end %>
<%= content_tag(:li, :class => (params[:controller] == "pages") ? :selected : nil) do %>
<%= link_to(icon("pages") + " " + Page.model_name.human(:count => :other), {:action => "index", :controller => "pages"}, :class => current_page?(pages_path) && params[:type].blank? ? :selected : nil) %>
<%= render :partial => "pages/menu" %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/application/_top.html.erb
Expand Up @@ -2,7 +2,7 @@
<table width="100%" cellpadding=0 cellspacing=0>
<tr>
<td>
<% if @setting[:section_items] %>
<% if true %>
<div class="search_box">
<%#= form_remote_tag :update => "content", :url => { :action => 'search'} %>
<%= form_tag({:action => 'search', :controller => "items"},{:id => "search_form", :method => :get}) %>
Expand Down
8 changes: 4 additions & 4 deletions app/views/browse/index.html.erb
Expand Up @@ -2,12 +2,12 @@
homepage = Page.find_by_name("home")
homepage_sidebar = Page.system.find_by_name("home_page_sidebar")
homepage_subpages = homepage.pages.display_in_menu.published.in_order
show_sidebar = homepage_subpages.size > 0 || @setting[:section_items] || !homepage_sidebar.content.blank?
show_sidebar = homepage_subpages.size > 0 || !homepage_sidebar.content.blank?
%>
<% content_for :side do %>
<%= render :partial => "pages/menu_for_page", :locals => {:page => homepage, :subpages => homepage_subpages} if homepage_subpages.size > 0 %>
<% if @setting[:section_items] %>
<% if true %>
<% if @setting[:homepage_type] != "categories" %>
<%= render :partial => "items/category_menu", :locals => {:options => {:category => @category}} %>
<% end %>
Expand All @@ -22,9 +22,9 @@
<% end if show_sidebar %>
<%= render homepage if homepage %>
<% if @setting[:homepage_type] == "new_items" && @setting[:section_items] %>
<% if @setting[:homepage_type] == "new_items" %>
<%= render :partial => "browse/homepage_new_items" %>
<% elsif @setting[:homepage_type] == "categories" && @setting[:section_items] %>
<% elsif @setting[:homepage_type] == "categories" %>
<%= render :partial => "browse/homepage_categories" %>
<% else %>
<%# Display nothing %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/pages/_list_pages.html.erb
Expand Up @@ -9,7 +9,7 @@
<ul id="pages" class="tree <%= "sortable" if options[:sortable] %> collapsed">
<% if pages.size > 0 %>
<% for page in pages %>
<% show_page = (page.name == "items") ? @setting[:section_items] : page.name == "blog" ? @setting[:section_blog] : page.name == "terms_of_service" ? @setting[:allow_user_registration] : true %>
<% show_page = (page.name == "items") ? true : page.name == "blog" ? true : page.name == "terms_of_service" ? @setting[:allow_user_registration] : true %>
<% if show_page %>
<li id="<%= page.id %>" class="root <%= "hoverable" if options[:sortable] %>">
<div class="box_2">
Expand Down
2 changes: 1 addition & 1 deletion app/views/pages/_menu.html.erb
Expand Up @@ -12,7 +12,7 @@
<%= icon("blog_post") + " " + t('activerecord.models.blog_page', :count => :other) %>
<%= content_tag :span, Page.blog_pages.size, :class => :count %>
<% end %>
<% end if @setting[:section_blog] %>
<% end %>
<%= content_tag :li, :class => (params[:type].downcase == "system") ? :selected : nil do %>
<%= link_to pages_path(:type => "System"), :class => (params[:type].downcase == "system") ? :selected : nil do %>
<%= icon("system_page") + " " + t('activerecord.models.system_page', :count => :other) %>
Expand Down
8 changes: 1 addition & 7 deletions app/views/settings/index.html.erb
Expand Up @@ -12,7 +12,6 @@
<li><a href="#<%= t("single.public") %>"><%= t("single.public") %></a></li>
<li><a href="#<%= t("single.system") %>"><%= t("single.system") %></a></li>
<li><a href="#<%= User.model_name.human(:count => :other) %>"><%= User.model_name.human(:count => :other) %></a></li>
<li><a href="#<%= t("single.section", :count => :other) %>"><%= t("single.section", :count => :other) %></a></li>
<li><a href="#<%= t("activerecord.records.setting.main_logo.title") %>"><%= t("activerecord.records.setting.main_logo.title") %></a></li>
<li><%= link_to "Home", "http://www.google.com" %></li>
</ul>
Expand All @@ -25,14 +24,9 @@
</div>
<div>
<%= render :partial => "/settings/list_settings", :locals => {:settings => Setting.find(:all, :conditions => ["setting_type = ?", "User"]), :title => User.model_name.human}%>
</div>
<div>
<%= render :partial => "/settings/list_settings", :locals => {:settings => Setting.find(:all, :conditions => ["setting_type = ?", "Section"]), :title => t("single.section")}%>
</div>
</div>
<div>
<div class="section">


<div class="header">
<table style="width:100%;" cellpadding=0 cellspacing=0>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion app/views/user/_menu.html.erb
Expand Up @@ -6,7 +6,7 @@
<% end %>
<%= content_tag :li, :class => params[:controller] == "items" ? :selected : nil do %>
<%= link_to(icon("items") + " " + Item.model_name.human(:count => :other), {:action => "my", :controller => "items"}, :class => params[:controller] == "items" ? :selected : nil) %>
<% end if (Setting.get_setting_bool("let_users_create_items") || @logged_in_user.is_admin?) && @setting[:section_items] %>
<% end if (Setting.get_setting_bool("let_users_create_items") || @logged_in_user.is_admin?) %>
<%= content_tag :li, :class => params[:controller] == "messages" ? :selected : nil do %>
<%= link_to(icon("mail") + " " + UserMessage.model_name.human(:count => :other), {:action => "for_me", :controller => "messages"}, :class => params[:controller] == "messages" ? :selected : nil) %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/show.html.erb
Expand Up @@ -72,7 +72,7 @@
<%= @user.group.name %>
<% end if @logged_in_user.is_admin? %>
<% if @setting[:section_items] && @items.size > 0 %>
<% if @items.size > 0 %>
<%= render :partial => "navigation" %>
<br>

Expand Down
11 changes: 11 additions & 0 deletions db/migrate/20120521230728_remove_section_settings.rb
@@ -0,0 +1,11 @@
class RemoveSectionSettings < ActiveRecord::Migration
def up
Setting.find_by_name("section_items").destroy
Setting.find_by_name("section_blog").destroy
end

def down
Setting.create(:name => "section_items", :value => "1", :setting_type => "Section", :item_type => "bool")
Setting.create(:name => "section_blog", :value => "1", :setting_type => "Section", :item_type => "bool")
end
end
4 changes: 1 addition & 3 deletions db/schema.rb
@@ -1,4 +1,3 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
Expand All @@ -11,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20120311001715) do
ActiveRecord::Schema.define(:version => 20120521230728) do

create_table "authentications", :force => true do |t|
t.integer "user_id"
Expand Down Expand Up @@ -139,7 +138,6 @@
t.boolean "display_children", :default => true
t.boolean "group_access_only", :default => false
t.string "group_ids"
t.text "side"
t.string "slug"
end

Expand Down

0 comments on commit 4a9b698

Please sign in to comment.