Merge branch 'design_team' of github.com:Rulingcom/orbit into design_team

Conflicts:
	app/views/admin/pages/_edit.html.erb
	app/views/admin/pages/_form.html.erb
	lib/parsers/parser_back_end.rb
This commit is contained in:
Christophe Vilayphiou committed 2012-05-13 23:14:13 +08:00
commit 01d0c002f5
48 files changed
+263 -286

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
@@ -32,3 +32,24 @@ $('.part_kind').live('click', function() {
$('.part_kind_partial').hide();
$('#part_' + $(this).attr('value')).show();
});
$(document).ready(function(){
$('ol.sortable').nestedSortable({
disableNesting: 'no-nest',
forcePlaceholderSize: true,
handle: 'i',
helper: 'clone',
items: 'li',
maxLevels: 3,
opacity: .5,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
stop: function(event, ui) {
$.post("<%= Rails.application.routes.url_helpers.admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: ui.item.parent().closest('li').attr('id'), position: ui.item.index() } );
}
});
});
+2 -2
View File
@@ -95,9 +95,9 @@ class ApplicationController < ActionController::Base
end
# Render the page
def render_page(param={})
def render_page
if @item
render :text => process_page(@item, param[:id], param), :layout => 'page_layout'
render :text => parse_page_noko(@item), :layout => 'page_layout'
else
render :text => '404 Not Found'
end
@@ -1,7 +1,7 @@
class OrbitFrontendComponentController< ApplicationController
before_filter :setup_vars
before_filter {|c| c.front_end_available(@app_title)}
layout :false
layout "module_widget"
def setup_vars
@app_title = request.fullpath.split('/')[2]
+11 -9
View File
@@ -19,7 +19,7 @@ class PagesController < ApplicationController
if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s))
case @item._type
when 'Page'
render_page(params)
render_page
when 'Link'
redirect_to "http://#{@item[:url]}"
end
@@ -32,17 +32,19 @@ class PagesController < ApplicationController
end
def index_from_link
if params[:page]
redirect_to "/#{@item.path}?page=#{params[:page]}&category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}"
else
redirect_to "/#{@item.path}?category_id=#{params[:category_id]}&tag_id=#{params[:tag_id]}"
end
url = "/#{@item.path}"
options = ''
options << "?page_main=#{params[:page_main]}" unless params[:page_main].blank?
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
redirect_to url + options
end
def show_from_link
# debugger
# a=1
redirect_to "/#{@item.path}?id=#{params[:id]}&preview=#{params[:preview]}"
url = "/#{@item.path}?id=#{params[:id]}"
options = ''
options << "&preview=#{params[:preview]}" unless params[:preview].blank?
redirect_to url + options
end
def load_orbit_bar
+1 -5
View File
@@ -89,11 +89,7 @@ module ApplicationHelper
def active_for_action(controller_name, action_name)
((controller.controller_name.eql?(controller_name) || request.fullpath.eql?(controller_name)) && controller.action_name.eql?(action_name)) ? 'active' : nil
end
def process_page(page, id, params)
parse_page_noko(page, id, params)
end
def page_metas(page)
tmp_meta = {}
metas = ''
+19 -1
View File
@@ -11,9 +11,27 @@ class PagePart
field :public_r_tag_option, :default => nil
field :widget_path
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
has_one :i18n_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
belongs_to :page
belongs_to :module_app
before_save :set_key
def i18n_variable
@i18n_variable ||= I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
end
def title
@title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil
end
protected
def set_key
title.key = 'title' if title && (title.key.blank? rescue true)
i18n_variable.key = 'i18n_variable' if i18n_variable && (i18n_variable.key.blank? rescue true)
end
end
@@ -1,25 +1 @@
<%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
<script>
$(document).ready(function(){
$('ol.sortable').nestedSortable({
disableNesting: 'no-nest',
forcePlaceholderSize: true,
handle: 'i',
helper: 'clone',
items: 'li',
maxLevels: 3,
opacity: .5,
placeholder: 'placeholder',
revert: 250,
tabSize: 25,
tolerance: 'pointer',
toleranceElement: '> div',
stop: function(event, ui) {
$.post("<%= admin_update_position_path %>", { id: ui.item.attr('id'), parent_id: ui.item.parent().closest('li').attr('id'), position: ui.item.index() } );
}
});
});
</script>
+1 -1
View File
@@ -2,7 +2,7 @@
<% LIST[:page_part_kinds].each do |kind| %>
<%= f.radio_button :kind, kind, :class => 'part_kind' %>
<%= t(kind) %>
<%= t(kind, :scope => 'admin.page_part_kinds') %>
<% end %>
<% LIST[:page_part_kinds].each do |kind| %>
@@ -1,3 +1,14 @@
<div>
<%= f.fields_for :title, @part.title do |f| %>
<% @site_valid_locales.each do |locale| %>
<p>
<%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}" %>
<%= f.text_field locale %>
</p>
<% end %>
<% end %>
</div>
<span id='module_app_list'>
<%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :title, :selected => @module_app.id), {}, {:rel => admin_page_parts_path} %>
</span>
+3 -1
View File
@@ -8,5 +8,7 @@
<% end %>
<script>
load_tinymce();
$(document).ready(function() {
load_tinymce();
});
</script>
+6 -6
View File
@@ -2,10 +2,10 @@
<div id="poststuff">
<h1><%= t('admin.editing_page') %></h1>
<%= form_for @item, :url => admin_page_path(@item), :html => { :class => 'form-horizontal edit_page' } do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<div class="form-actions">
<%= f.submit t('update'), :class => 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<%= render :partial => "form", :locals => { :f => f } %>
<div class="form-actions">
<%= f.submit t('update'), :class => 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<% end %>
</div>
<% end %>
+8 -8
View File
@@ -5,7 +5,7 @@
<%= f.label :name, t('admin.name'), :class => 'control-label' %>
<div class="controls">
<%= f.text_field :name, :class => 'text input-xlarge' %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
@@ -15,7 +15,7 @@
<%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class => 'text input-xlarge' %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<% end %>
@@ -25,14 +25,14 @@
<%= f.label :name, t('admin.design_name'), :class => 'control-label' %>
<div class="controls">
<%= f.collection_select :design, @designs, :id, :title, {:selected => @design.id}, {:rel => admin_pages_path} %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
<%= f.label :name, t('admin.theme'), :class => 'control-label' %>
<div class="controls">
<%= f.select :theme_id, @design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
@@ -45,7 +45,7 @@
<span id="app_page_category">
<%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%>
</span>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
@@ -59,7 +59,7 @@
<%= f.radio_button :is_published, false %>
No
</label>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
@@ -72,7 +72,7 @@
</label>
<% end %>
<%= hidden_field_tag 'page[menu_enabled_for][]', '' %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
@@ -86,7 +86,7 @@
</label>
<% end %>
<%= hidden_field_tag 'page[enabled_for][]', '' %>
<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
+10 -12
View File
@@ -1,13 +1,11 @@
<h1><%= t('admin.new_page') %></h1>
<%= flash_messages %>
<%= form_for @item, :url => admin_pages_path, :html => { :class => 'form' } do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<p>
<%= f.submit t('create') %> <%= link_back %>
</p>
<% end %>
<div id="poststuff">
<h1><%= t('admin.new_page') %></h1>
<%= form_for @item, :url => admin_page_path, :html => { :class => 'form-horizontal edit_page' } do |f| %>
<%= render :partial => "form", :locals => { :f => f } %>
<div class="form-actions">
<%= f.submit t('update'), :class => 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<% end %>
</div>
+3 -1
View File
@@ -5,7 +5,9 @@
<%= javascript_include_tag "html5" %>
<![endif]-->
<%#= stylesheet_link_tag "module_widget" %>
<%= javascript_include_tag "module_widget" %>
<%= javascript_include_tag "module" %>
<%#= javascript_include_tag "#{@app_title}/module_widget" %>
<%= yield :page_specific_javascript %>
<%= csrf_meta_tag %>
</head>
<body>