Clean code for layout and modifications in dev.rake
This commit is contained in:
1 parent
e74f2931b1
commit
7a4ad240a8
22 files changed
+226
-159
No files matched your search
@@ -1,54 +0,0 @@
|
||||
class Admin::LayoutsController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
||||
def index
|
||||
@layouts = Layout.all.entries
|
||||
end
|
||||
|
||||
def show
|
||||
#TODO
|
||||
# @layout = Layout.find(params[:id])
|
||||
# redirect_to "/#{@layout.name}"
|
||||
end
|
||||
|
||||
def new
|
||||
@layout = Layout.new
|
||||
end
|
||||
|
||||
def edit
|
||||
@layout = Layout.find(params[:id])
|
||||
end
|
||||
|
||||
def create
|
||||
@layout = Layout.new(params[:layout])
|
||||
|
||||
if @layout.save
|
||||
flash[:notice] = t('admin.create_success_layout')
|
||||
redirect_to admin_layouts_url
|
||||
else
|
||||
render :action => 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@layout = Layout.find(params[:id])
|
||||
|
||||
if @layout.update_attributes(params[:layout])
|
||||
flash[:notice] = t('admin.update_success_layout')
|
||||
redirect_to admin_layouts_url
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@layout = Layout.find(params[:id])
|
||||
@layout.destroy
|
||||
|
||||
redirect_to admin_layouts_url
|
||||
end
|
||||
|
||||
end
|
||||
@@ -3,6 +3,8 @@ class Admin::PurchasesController < ApplicationController
|
||||
require "uri"
|
||||
require 'zip/zip'
|
||||
|
||||
layout "admin"
|
||||
|
||||
def index
|
||||
@purchases = Purchase.all.entries
|
||||
end
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
class SitesController < ApplicationController
|
||||
class Admin::SitesController < ApplicationController
|
||||
|
||||
#layout 'set_up'
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
||||
def index
|
||||
@site = Site.first
|
||||
@@ -12,6 +12,8 @@ class Design
|
||||
validates_presence_of :title
|
||||
validates_presence_of :author
|
||||
|
||||
has_many :pages
|
||||
|
||||
embeds_one :layout
|
||||
mount_uploader :structure_css, AssetUploader
|
||||
|
||||
|
||||
+1
-4
@@ -1,14 +1,11 @@
|
||||
class Page < Item
|
||||
|
||||
#include LayoutSupport
|
||||
|
||||
field :content
|
||||
field :design_name
|
||||
field :design_id
|
||||
|
||||
validates_presence_of :design_name, :design_id
|
||||
|
||||
referenced_in :design
|
||||
belongs_to :design
|
||||
has_many :page_parts
|
||||
|
||||
def create_parts
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<% content_for :secondary do %>
|
||||
<ul class="list">
|
||||
<li><%= link_to t(:new_design, :scope => :admin), new_admin_design_path, :class => 'button positive' %></li>
|
||||
<li><%= link_to t(:new_design, :scope => :admin), new_admin_design_path %></li>
|
||||
<li><%= link_to t('admin.upload_design'), upload_package_admin_designs_path %></li>
|
||||
</ul>
|
||||
<% end -%>
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<p>
|
||||
<%= f.label :name, t('admin.name') %>
|
||||
<%= f.text_field :name, :class => 'text' %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.label :description, t('admin.description') %>
|
||||
<%= f.text_field :description, :class => 'text' %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.label "content", t('admin.content') %>
|
||||
<%= f.text_area :content, :size => '100x30' %>
|
||||
</p>
|
||||
@@ -1,9 +0,0 @@
|
||||
<h1><%= t('admin.editing_layout') %></h1>
|
||||
|
||||
<%= form_for @layout, :url => admin_layout_path(@layout) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
<p>
|
||||
<%= f.submit t('update') %> <%= link_back %>
|
||||
</p>
|
||||
<% end %>
|
||||
@@ -1,28 +0,0 @@
|
||||
<% content_for :secondary do %>
|
||||
<ul class="list">
|
||||
<li><%= link_to t(:new_layout, :scope => :admin), new_admin_layout_path, :class => 'button positive' %></li>
|
||||
</ul>
|
||||
<% end -%>
|
||||
|
||||
<%= flash_messages %>
|
||||
|
||||
<h1><%= t('admin.list_layouts') %></h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th><%= t('admin.name') %></th>
|
||||
<th><%= t('admin.description') %></th>
|
||||
<th><%= t('admin.action') %></th>
|
||||
</tr>
|
||||
|
||||
<% @layouts.each do |layout| %>
|
||||
<tr>
|
||||
<td><%= layout.name %></td>
|
||||
<td><%= layout.description %></td>
|
||||
<td>
|
||||
<%= link_to t(:edit), edit_admin_layout_path(layout) %> |
|
||||
<%= link_to t(:delete), admin_layout_path(layout), :confirm => t('sure?'), :method => :delete %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
@@ -1,10 +0,0 @@
|
||||
<h1><%= t('admin.new_layout') %></h1>
|
||||
|
||||
<%= form_for :layout, :url => admin_layouts_path do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= render :partial => "form", :locals => { :f => f } %>
|
||||
|
||||
<p>
|
||||
<%= f.submit t('create') %> <%= link_back %>
|
||||
</p>
|
||||
<% end %>
|
||||
File renamed without changes.
File renamed without changes.
@@ -28,18 +28,17 @@
|
||||
</div>
|
||||
|
||||
<div id="header">
|
||||
|
||||
<h1>RulingSite <%= t('admin.admin') %></h1>
|
||||
|
||||
<ul id="nav">
|
||||
<li><%= link_to t('homepage'), root_path %></li>
|
||||
<li><%= link_to t('admin.layout'), admin_layouts_path %></li>
|
||||
<li><%= link_to t('admin.design'), admin_designs_path %></li>
|
||||
<li><%= link_to t('admin.asset'), admin_assets_path %></li>
|
||||
<li><%= link_to t('admin.user_info'), admin_user_info_models_path %></li>
|
||||
<li><%= link_to t('admin.user_role'), admin_user_role_models_path %></li>
|
||||
<li><%= link_to t('admin.translation'), admin_translations_path %></li>
|
||||
</ul>
|
||||
<h1>RulingSite <%= t('admin.admin') %></h1>
|
||||
<ul id="nav">
|
||||
<li><%= link_to t('homepage'), root_path %></li>
|
||||
<li><%= link_to t('admin.item'), admin_items_path %></li>
|
||||
<li><%= link_to t('admin.design'), admin_designs_path %></li>
|
||||
<li><%= link_to t('admin.purchase'), admin_purchases_path %></li>
|
||||
<li><%= link_to t('admin.asset'), admin_assets_path %></li>
|
||||
<li><%= link_to t('admin.user_info'), admin_user_info_models_path %></li>
|
||||
<li><%= link_to t('admin.user_role'), admin_user_role_models_path %></li>
|
||||
<li><%= link_to t('admin.translation'), admin_translations_path %></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<%= yield :page_specific_link %>
|
||||
<%= stylesheet_link_tag "content", :media => "screen, projection" %>
|
||||
<%= javascript_include_tag :ckeditor %>
|
||||
<%#= javascript_include_tag :ckeditor %>
|
||||
|
||||
<%= javascript_include_tag "jquery", "jquery-ui", "rails", "easy", "application", :cache => 'all' %>
|
||||
<%#= javascript_include_tag "jquery", "jquery-ui", "rails", "easy", "application", :cache => 'all' %>
|
||||
<%= yield :page_specific_javascript %>
|
||||
<!--[if IE]>
|
||||
<%= stylesheet_link_tag "ie", :media => "screen, projection" %>
|
||||
@@ -21,7 +21,8 @@
|
||||
<ul id="panel_nav">
|
||||
<li><%= link_to t('homepage'), root_path %></li>
|
||||
<li><%= link_to t('admin.item'), admin_items_path %></li>
|
||||
<li><%= link_to t('admin.layout'), admin_layouts_path %></li>
|
||||
<li><%= link_to t('admin.design'), admin_designs_path %></li>
|
||||
<li><%= link_to t('admin.purchase'), admin_purchases_path %></li>
|
||||
<li><%= link_to t('admin.asset'), admin_assets_path %></li>
|
||||
<li><%= link_to t('admin.user_info'), admin_user_info_models_path %></li>
|
||||
<li><%= link_to t('admin.user_role'), admin_user_role_models_path %></li>
|
||||
|
||||
Reference in new issue
Block a user