Links edition
This commit is contained in:
		
							parent
							
								
									d9ba76ebd5
								
							
						
					
					
						commit
						24ae7ed5e3
					
				| 
						 | 
					@ -6,12 +6,14 @@ class Admin::ItemsController < ApplicationController
 | 
				
			||||||
  before_filter :find_parent_item
 | 
					  before_filter :find_parent_item
 | 
				
			||||||
  before_filter :find_snippets, :only => :index
 | 
					  before_filter :find_snippets, :only => :index
 | 
				
			||||||
  before_filter :is_admin?
 | 
					  before_filter :is_admin?
 | 
				
			||||||
 | 
					  before_filter :set_current_item
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  def index
 | 
					  def index
 | 
				
			||||||
    if params[:item_id]
 | 
					    if params[:item_id]
 | 
				
			||||||
      @page = Item.find(params[:item_id])
 | 
					      @item = Item.find(params[:item_id])
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      @page = Item.first(:conditions => {:parent_id => nil})
 | 
					      @item = Item.first(:conditions => {:parent_id => nil})
 | 
				
			||||||
 | 
					      @page = @item
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,18 +1,19 @@
 | 
				
			||||||
class Admin::LinksController < ApplicationController
 | 
					class Admin::LinksController < ApplicationController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  layout "admin"
 | 
					  layout "content"
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  before_filter :authenticate_user!
 | 
					  before_filter :authenticate_user!
 | 
				
			||||||
  before_filter :find_parent_item
 | 
					  before_filter :find_parent_item
 | 
				
			||||||
  before_filter :is_admin?
 | 
					  before_filter :is_admin?
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  def show
 | 
					  def show
 | 
				
			||||||
    #TODO
 | 
					    @link ||= Link.find(params[:id])
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  def new
 | 
					  def new
 | 
				
			||||||
    @link = Link.new
 | 
					    @link = Link.new
 | 
				
			||||||
    @link.is_published = true
 | 
					    @link.is_published = true
 | 
				
			||||||
    @link.parent_id = @parent_item.id rescue nil
 | 
					    @link.parent_id = Page.find(params[:parent_id]).id rescue nil
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def edit
 | 
					  def edit
 | 
				
			||||||
| 
						 | 
					@ -24,9 +25,16 @@ class Admin::LinksController < ApplicationController
 | 
				
			||||||
    @link = Link.new(params[:link])
 | 
					    @link = Link.new(params[:link])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if @link.save
 | 
					    if @link.save
 | 
				
			||||||
      flash[:notice] = t('admin.create_success_link')
 | 
					      flash.now[:notice] = t('admin.create_success_link')
 | 
				
			||||||
      redirect_to admin_items_url( :parent_id => @link.parent_id )
 | 
					      respond_to do |format|
 | 
				
			||||||
 | 
					        format.html { 
 | 
				
			||||||
 | 
					          redirect_to admin_link_url(@link) 
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        format.js  {}
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
 | 
					      flash.now[:error] = t('admin.create_error_link')
 | 
				
			||||||
 | 
					      @i18n_variable = @link.i18n_variable
 | 
				
			||||||
      render :action => "new"
 | 
					      render :action => "new"
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					@ -35,9 +43,16 @@ class Admin::LinksController < ApplicationController
 | 
				
			||||||
    @link = Link.find(params[:id])
 | 
					    @link = Link.find(params[:id])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if @link.update_attributes(params[:link])
 | 
					    if @link.update_attributes(params[:link])
 | 
				
			||||||
      flash[:notice] = t('admin.update_success_link')
 | 
					      flash.now[:notice] = t('admin.update_success_link')
 | 
				
			||||||
      redirect_to admin_items_url( :parent_id => @link.parent_id )
 | 
					      respond_to do |format|
 | 
				
			||||||
 | 
					        format.html { 
 | 
				
			||||||
 | 
					          redirect_to admin_link_url(@link) 
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        format.js  {}
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
 | 
					      flash.now[:error] = t('admin.update_error_link')
 | 
				
			||||||
 | 
					      @i18n_variable = @link.i18n_variable
 | 
				
			||||||
      render :action => "edit"
 | 
					      render :action => "edit"
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					@ -46,8 +61,16 @@ class Admin::LinksController < ApplicationController
 | 
				
			||||||
    @link = Link.find(params[:id])
 | 
					    @link = Link.find(params[:id])
 | 
				
			||||||
    @link.destroy
 | 
					    @link.destroy
 | 
				
			||||||
    @link.destroy_i18n_variable
 | 
					    @link.destroy_i18n_variable
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
    redirect_to admin_items_url( :parent_id => @link.parent_id )
 | 
					  def delete
 | 
				
			||||||
 | 
					    destroy
 | 
				
			||||||
 | 
					    respond_to do |format|
 | 
				
			||||||
 | 
					      format.html { 
 | 
				
			||||||
 | 
					        redirect_to admin_items_url
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      format.js  {}
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,12 +1,21 @@
 | 
				
			||||||
class Admin::PagesController < ApplicationController
 | 
					class Admin::PagesController < ApplicationController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  layout "content"
 | 
					  layout "content"
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  before_filter :authenticate_user!
 | 
					  before_filter :authenticate_user!
 | 
				
			||||||
  before_filter :find_parent_item
 | 
					  before_filter :find_parent_item
 | 
				
			||||||
  before_filter :is_admin?
 | 
					  before_filter :is_admin?
 | 
				
			||||||
 | 
					  before_filter :set_current_item
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  def show
 | 
					  def show
 | 
				
			||||||
    #TODO
 | 
					    @page = Page.find(params[:id])
 | 
				
			||||||
 | 
					    respond_to do |format|
 | 
				
			||||||
 | 
					      format.html { 
 | 
				
			||||||
 | 
					        @item = @page
 | 
				
			||||||
 | 
					        render 'admin/items/index' 
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      format.js  {}
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def new
 | 
					  def new
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,4 +52,8 @@ class ApplicationController < ActionController::Base
 | 
				
			||||||
    @site_valid_locales = @site.valid_locales
 | 
					    @site_valid_locales = @site.valid_locales
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  def set_current_item
 | 
				
			||||||
 | 
					    session[:current_page] = params[:id] || @page.id || @link.id || @item.id rescue nil
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,25 +49,35 @@ module ApplicationHelper
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  def render_node_and_children(node, current_name = 'home')
 | 
					  def render_node_and_children(node)
 | 
				
			||||||
    ret = ''
 | 
					    ret = ''
 | 
				
			||||||
    if node
 | 
					    if node
 | 
				
			||||||
 | 
					      case node._type
 | 
				
			||||||
 | 
					        when 'Page'
 | 
				
			||||||
 | 
					          dest = admin_page_path(:id => node.id)
 | 
				
			||||||
 | 
					        when 'Link'
 | 
				
			||||||
 | 
					          dest = admin_link_path(:id => node.id)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
      ret << "<li>"
 | 
					      ret << "<li>"
 | 
				
			||||||
      ret << (link_to node.name, admin_items_path(:item_id => node.id), :remote => true, :class => (current_name.eql?(node.name) ? 'sidebar_no_link' : 'sidebar_link'))
 | 
					      ret << (link_to node.name, dest)
 | 
				
			||||||
      ret << render_children(node) if node.children.size > 0
 | 
					      ret << ' | ' << (link_to 'new_link', new_admin_link_path(:parent_id => node.id)) if node._type.eql?('Page')
 | 
				
			||||||
 | 
					      ret << ' | ' << (link_to t(:delete), delete_admin_link_path(node, :authenticity_token => form_authenticity_token), :confirm => t('sure?'), :class => 'delete') if node._type.eql?('Link')
 | 
				
			||||||
 | 
					      ret << render_children(node)
 | 
				
			||||||
      ret << "</li>"
 | 
					      ret << "</li>"
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    ret.html_safe
 | 
					    ret.html_safe
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  def render_children(parent)
 | 
					  def render_children(parent)
 | 
				
			||||||
 | 
					    if children = parent.children
 | 
				
			||||||
      ret = ''
 | 
					      ret = ''
 | 
				
			||||||
      ret << "<ul>"
 | 
					      ret << "<ul>"
 | 
				
			||||||
    parent.children.each do |child|
 | 
					      children.each do |child|
 | 
				
			||||||
        ret << render_node_and_children(child)
 | 
					        ret << render_node_and_children(child)
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
      ret << "</ul>"
 | 
					      ret << "</ul>"
 | 
				
			||||||
      ret
 | 
					      ret
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,11 +0,0 @@
 | 
				
			||||||
 | 
					 | 
				
			||||||
  <td><%= item.class %></td>
 | 
					 | 
				
			||||||
  <td><%= link_to item.name, admin_items_path(:parent_id => item.id) %></td>
 | 
					 | 
				
			||||||
  <td><%= item.i18n_variable[I18n.locale] rescue nil %>
 | 
					 | 
				
			||||||
  <td><%= item.position %></td>
 | 
					 | 
				
			||||||
  <td><%= item.is_published.to_s %></td>
 | 
					 | 
				
			||||||
  <td>
 | 
					 | 
				
			||||||
    <%= link_to t(:show), item.url %> | 
 | 
					 | 
				
			||||||
    <%= link_to t(:edit), edit_admin_page_path(item) %> |
 | 
					 | 
				
			||||||
    <%= link_to t(:delete), admin_page_path(item), :confirm => t('sure?'), :method => :delete %>
 | 
					 | 
				
			||||||
  </td>
 | 
					 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					<%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
 | 
				
			||||||
| 
						 | 
					@ -1,55 +1,24 @@
 | 
				
			||||||
<% content_for :sidebar do %>
 | 
					<% content_for :sidebar do %>
 | 
				
			||||||
	<div id='sidebar'><%= render 'layouts/site_map_left_bar' %></div>
 | 
						<div id='sidebar'><%= render 'admin/items/site_map_left_bar' %></div>
 | 
				
			||||||
<% end -%>
 | 
					<% end -%>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<% content_for :page_specific_javascript do %>
 | 
					<% content_for :page_specific_javascript do %>
 | 
				
			||||||
  <script type="text/javascript" charset="utf-8">
 | 
					  <!-- <script type="text/javascript" charset="utf-8">
 | 
				
			||||||
    $('a.sidebar_link').live( "click", function(){
 | 
					    $('a.sidebar_link').live( "click", function(){
 | 
				
			||||||
			$(this).removeClass('sidebar_link');
 | 
								$(this).removeClass('sidebar_link');
 | 
				
			||||||
			$('.sidebar_no_link').addClass('sidebar_link');
 | 
								$('.sidebar_no_link').addClass('sidebar_link');
 | 
				
			||||||
			$('.sidebar_no_link').removeClass('sidebar_no_link');
 | 
								$('.sidebar_no_link').removeClass('sidebar_no_link');
 | 
				
			||||||
			$(this).addClass('sidebar_no_link');
 | 
								$(this).addClass('sidebar_no_link');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  </script>
 | 
					  </script> -->
 | 
				
			||||||
<% end -%>
 | 
					<% end -%>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<% content_for :page_specific_css do %>
 | 
					<% content_for :page_specific_css do %>
 | 
				
			||||||
	<style type="text/css">
 | 
						<!-- <style type="text/css">
 | 
				
			||||||
		.sidebar_no_link {
 | 
							.sidebar_no_link {
 | 
				
			||||||
		       pointer-events: none;
 | 
							       pointer-events: none;
 | 
				
			||||||
		       cursor: default;
 | 
							       cursor: default;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	</style>
 | 
						</style> -->
 | 
				
			||||||
<% end %>
 | 
					<% end %>
 | 
				
			||||||
 | 
					<%= render "admin/#{@item._type.downcase.pluralize}/show" %>
 | 
				
			||||||
<%= render 'layouts/page' %>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<!-- <%= flash_messages %>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<h1><%= t('admin.list_items') %>: <%= show_parent_items_link unless @parent_item.nil? %></h1>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<% if !Layout.exist_one? %>
 | 
					 | 
				
			||||||
    <div style='color:red'><%= t('admin.no_layout') %>: <%= link_to t('create').downcase, new_admin_layout_path %></div>
 | 
					 | 
				
			||||||
    <br/>
 | 
					 | 
				
			||||||
<% else %>
 | 
					 | 
				
			||||||
  <table>
 | 
					 | 
				
			||||||
    <tr>
 | 
					 | 
				
			||||||
      <th><%= t('admin.class') %></th>
 | 
					 | 
				
			||||||
      <th><%= t('admin.name') %></th>
 | 
					 | 
				
			||||||
      <th><%= t('admin.title') %></th>
 | 
					 | 
				
			||||||
      <th><%= t('admin.position') %></th>
 | 
					 | 
				
			||||||
      <th><%= t('admin.published?') %></th>
 | 
					 | 
				
			||||||
      <th><%= t('admin.action') %></th>
 | 
					 | 
				
			||||||
      <th></th>
 | 
					 | 
				
			||||||
    </tr>
 | 
					 | 
				
			||||||
  <% @items.each do |item| %>
 | 
					 | 
				
			||||||
    <tr>
 | 
					 | 
				
			||||||
      <%= render :partial => item.class.to_s.downcase, :locals => { :item => item } %>
 | 
					 | 
				
			||||||
      <!--<td><%= link_to t(:move_up, :scope => :admin), up_admin_item_path(item), :method => :put %> |
 | 
					 | 
				
			||||||
      <%= link_to t(:move_down, :scope => :admin), down_admin_item_path(item), :method => :put %></td>-->
 | 
					 | 
				
			||||||
    </tr>    
 | 
					 | 
				
			||||||
  <% end if @items %>
 | 
					 | 
				
			||||||
  </table>
 | 
					 | 
				
			||||||
<% end %>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<%= render :partial => "snippets", :locals => { :snippets => @snippets } %> -->
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
$('#main').empty();
 | 
					$('#main').empty();
 | 
				
			||||||
switch ("<%= escape_javascript(@page._type)%>") {
 | 
					switch ("<%= escape_javascript(@item._type)%>") {
 | 
				
			||||||
	case 'Link': 
 | 
						case 'Link': 
 | 
				
			||||||
		$('#main').append("TODO: page to edit the link");
 | 
							$('#main').append("<%= escape_javascript(render(:partial => 'admin/links/show')) %>");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
  case 'Page': 
 | 
					  case 'Page': 
 | 
				
			||||||
		$('#main').append("<%= escape_javascript(render(:partial => 'layouts/page')) %>");
 | 
							$('#main').append("<%= escape_javascript(render(:partial => 'page')) %>");
 | 
				
			||||||
   	break;
 | 
					   	break;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					<h1><%= t('admin.editing_link') %></h1>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<%= flash_messages %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<%= form_for @link, :url => admin_link_path(@link), :html => { :class => 'form' } do |f| %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <%= render :partial => "admin/links/form", :locals => { :f => f } %>
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  <p>
 | 
				
			||||||
 | 
					    <%= f.submit t(:update) %> <%= link_back %>
 | 
				
			||||||
 | 
					  </p>
 | 
				
			||||||
 | 
					<% end %>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,13 @@
 | 
				
			||||||
 | 
					<h1><%= t('admin.new_link') %></h1>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<%= flash_messages %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<%= form_for @link, :url => admin_links_path, :html => { :class => 'form' } do |f| %>
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  <%= render :partial => "admin/links/form", :locals => { :f => f } %>
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  <p>
 | 
				
			||||||
 | 
					    <%= f.submit t(:create) %> <%= link_back %>
 | 
				
			||||||
 | 
					  </p>
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					<% end %>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,24 @@
 | 
				
			||||||
 | 
					<%= flash_messages %>
 | 
				
			||||||
 | 
					<p>
 | 
				
			||||||
 | 
					  <b><%= t('admin.name') %></b>
 | 
				
			||||||
 | 
					  <%= @link.name %>
 | 
				
			||||||
 | 
					</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<% @site_valid_locales.each do |locale| %>
 | 
				
			||||||
 | 
					  <p>
 | 
				
			||||||
 | 
							<b><%= "#{t('admin.title')} #{locale}" %></b>
 | 
				
			||||||
 | 
						  <%= @link.i18n_variable[locale] if @link.i18n_variable %>
 | 
				
			||||||
 | 
					  </p>
 | 
				
			||||||
 | 
					<% end %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<p>
 | 
				
			||||||
 | 
					  <b><%= t('admin.is_published') %></b>
 | 
				
			||||||
 | 
					  <%= @link.is_published.to_s %>
 | 
				
			||||||
 | 
					</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<p>
 | 
				
			||||||
 | 
					  <b><%= t('admin.url') %></b>
 | 
				
			||||||
 | 
					  <%= @link.url %>
 | 
				
			||||||
 | 
					</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<%= link_to t(:edit), edit_admin_link_path(@link) %>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					$('#sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
 | 
				
			||||||
 | 
					$('#main').html("<%= escape_javascript(render(:partial => 'admin/links/show')) %>");
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					$('#sidebar').html("<%= escape_javascript(render(:partial => 'admin/items/site_map_left_bar')) %>");
 | 
				
			||||||
| 
						 | 
					@ -1,10 +1,5 @@
 | 
				
			||||||
<h1><%= t('admin.editing_link') %></h1>
 | 
					<% content_for :sidebar do %>
 | 
				
			||||||
 | 
						<div id='sidebar'><%= render 'admin/items/site_map_left_bar' %></div>
 | 
				
			||||||
 | 
					<% end -%>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<%= form_for @link, :url => admin_link_path(@link) do |f| %>
 | 
					<%= render 'edit' %>
 | 
				
			||||||
 | 
					 | 
				
			||||||
  <%= render :partial => "form", :locals => { :f => f } %>
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  <p>
 | 
					 | 
				
			||||||
    <%= f.submit t(:update) %> <%= link_back %>
 | 
					 | 
				
			||||||
  </p>
 | 
					 | 
				
			||||||
<% end %>
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					$('#main').html("<%= escape_javascript(render(:partial => 'admin/links/edit')) %>");
 | 
				
			||||||
| 
						 | 
					@ -1,11 +1,5 @@
 | 
				
			||||||
<h1><%= t('admin.new_link') %></h1>
 | 
					<% content_for :sidebar do %>
 | 
				
			||||||
 | 
						<div id='sidebar'><%= render 'admin/items/site_map_left_bar' %></div>
 | 
				
			||||||
 | 
					<% end -%>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<%= form_for @link, :url => admin_links_path do |f| %>
 | 
					<%= render 'new' %>
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  <%= render :partial => "form", :locals => { :f => f } %>
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  <p>
 | 
					 | 
				
			||||||
    <%= f.submit t(:create) %> <%= link_back %>
 | 
					 | 
				
			||||||
  </p>
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
<% end %>
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					$('#main').html("<%= escape_javascript(render(:partial => 'admin/links/new')) %>");
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					<% content_for :sidebar do %>
 | 
				
			||||||
 | 
						<div id='sidebar'><%= render 'admin/items/site_map_left_bar' %></div>
 | 
				
			||||||
 | 
					<% end -%>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<%= render 'show' %>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					$('#main').html("<%= escape_javascript(render(:partial => 'show')) %>");
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					$('#main').html("<%= escape_javascript(render(:partial => 'admin/links/show')) %>");
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					<%= parse_page(@page).html_safe %>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					<%= render 'show' %>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					$('#main').html("<%= escape_javascript(render(:partial => 'show')) %>");
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
<%= parse_page(@page).html_safe if @page._type.eql?('Page') %>
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
<%= render_node_and_children(@page) %>
 | 
					 | 
				
			||||||
| 
						 | 
					@ -2,12 +2,13 @@
 | 
				
			||||||
<html>
 | 
					<html>
 | 
				
			||||||
<head>
 | 
					<head>
 | 
				
			||||||
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 | 
					  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 | 
				
			||||||
  <title><%= @title %></title>
 | 
					  <title><%= @title || 'R4 rescue title' %></title>
 | 
				
			||||||
  <link rel="shortcut icon" href="/favicon.ico">
 | 
					  <link rel="shortcut icon" href="/favicon.ico">
 | 
				
			||||||
  <%= yield :page_specific_link %>
 | 
					  <%= yield :page_specific_link %>
 | 
				
			||||||
  <%= stylesheet_link_tag "easy", "main", "devise", "content", :media => "screen, projection" %>
 | 
					  <%= stylesheet_link_tag "easy", "main", "devise", "content", :media => "screen, projection" %>
 | 
				
			||||||
  <%= stylesheet_link_tag "easyprint", :media => "print" %>
 | 
					  <%= stylesheet_link_tag "easyprint", :media => "print" %>
 | 
				
			||||||
	<%= javascript_include_tag "jquery", "jquery-ui", "rails", "easy", "application", :cache => 'all' %>
 | 
						<%= javascript_include_tag "jquery", "jquery-ui", "rails", "easy", :cache => 'all' %>
 | 
				
			||||||
 | 
						<%= javascript_include_tag "application", :cache => 'all' %>
 | 
				
			||||||
	<%= yield :page_specific_javascript %>
 | 
						<%= yield :page_specific_javascript %>
 | 
				
			||||||
  <!--[if IE]>
 | 
					  <!--[if IE]>
 | 
				
			||||||
    <%= stylesheet_link_tag "ie", :media => "screen, projection" %>
 | 
					    <%= stylesheet_link_tag "ie", :media => "screen, projection" %>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,11 +88,13 @@ en:
 | 
				
			||||||
    title: Title
 | 
					    title: Title
 | 
				
			||||||
    translation: Translation
 | 
					    translation: Translation
 | 
				
			||||||
    type: Type
 | 
					    type: Type
 | 
				
			||||||
 | 
					    update_error_link: Error when updating link.
 | 
				
			||||||
    update_success_home: Homepage was successfully updated.
 | 
					    update_success_home: Homepage was successfully updated.
 | 
				
			||||||
    update_success_layout: Layout was successfully updated.
 | 
					    update_success_layout: Layout was successfully updated.
 | 
				
			||||||
    update_success_link: Link was successfully updated.
 | 
					    update_success_link: Link was successfully updated.
 | 
				
			||||||
    update_success_page: Page was successfully updated.
 | 
					    update_success_page: Page was successfully updated.
 | 
				
			||||||
    update_success_snippet: Snippet was successfully updated.
 | 
					    update_success_snippet: Snippet was successfully updated.
 | 
				
			||||||
 | 
					    url: URL
 | 
				
			||||||
    user_info: User information
 | 
					    user_info: User information
 | 
				
			||||||
    user_role: User role
 | 
					    user_role: User role
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,11 +85,13 @@ zh_tw:
 | 
				
			||||||
    title: 標題
 | 
					    title: 標題
 | 
				
			||||||
    translation: 翻譯
 | 
					    translation: 翻譯
 | 
				
			||||||
    type: 類型
 | 
					    type: 類型
 | 
				
			||||||
 | 
					    update_error_link: 更新鏈接時出現錯誤。
 | 
				
			||||||
    update_success_home: 首頁已成功更新。
 | 
					    update_success_home: 首頁已成功更新。
 | 
				
			||||||
    update_success_layout: 樣板已成功更新。
 | 
					    update_success_layout: 樣板已成功更新。
 | 
				
			||||||
    update_success_link: 連結已成功更新。
 | 
					    update_success_link: 連結已成功更新。
 | 
				
			||||||
    update_success_page: 頁面已成功更新。
 | 
					    update_success_page: 頁面已成功更新。
 | 
				
			||||||
    update_success_snippet: 片段已成功更新。
 | 
					    update_success_snippet: 片段已成功更新。
 | 
				
			||||||
 | 
					    url: URL
 | 
				
			||||||
    user_info: 用戶資料
 | 
					    user_info: 用戶資料
 | 
				
			||||||
    user_role: 用戶角色
 | 
					    user_role: 用戶角色
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,11 @@ PrototypeR4::Application.routes.draw do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     end
 | 
					     end
 | 
				
			||||||
    resources :layouts
 | 
					    resources :layouts
 | 
				
			||||||
    resources :links
 | 
					    resources :links do
 | 
				
			||||||
 | 
					      member do
 | 
				
			||||||
 | 
					        get 'delete'
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
    resources :pages
 | 
					    resources :pages
 | 
				
			||||||
    resources :homes
 | 
					    resources :homes
 | 
				
			||||||
    resources :snippets
 | 
					    resources :snippets
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,21 @@
 | 
				
			||||||
// Place your application-specific JavaScript functions and classes here
 | 
					// Place your application-specific JavaScript functions and classes here
 | 
				
			||||||
// This file is automatically included by javascript_include_tag :defaults
 | 
					// This file is automatically included by javascript_include_tag :defaults
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$(function () {
 | 
				
			||||||
 | 
					  $('#sidebar a, #main a').live('click',  
 | 
				
			||||||
 | 
					    function () {  
 | 
				
			||||||
 | 
					      $.getScript(this.href);
 | 
				
			||||||
 | 
								history.pushState(null, document.title, this.href); 
 | 
				
			||||||
 | 
					      return false;  
 | 
				
			||||||
 | 
					    }  
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						$('.form').live('submit', function () { 
 | 
				
			||||||
 | 
					    $.post(this.action, $(this).serialize(), null, 'script');  
 | 
				
			||||||
 | 
					    return false;  
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						$(window).bind("popstate", function () {  
 | 
				
			||||||
 | 
					    $.getScript(location.href);  
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
		Reference in New Issue