Merge branch 'ad_banner' of https://github.com/Rulingcom/orbit into ad_banner
This commit is contained in:
commit
3e37f72730
|
@ -1,3 +1,7 @@
|
||||||
|
$('.bulletin_urls_block a.delete').live('click', function(){
|
||||||
|
$(this).parents('.list_item').remove();
|
||||||
|
});
|
||||||
|
|
||||||
$('.bulletin_files_block a.delete').live('click', function(){
|
$('.bulletin_files_block a.delete').live('click', function(){
|
||||||
$(this).parents('.list_item').remove();
|
$(this).parents('.list_item').remove();
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,21 +24,21 @@ PrototypeR4::Application.configure do
|
||||||
config.action_dispatch.best_standards_support = :builtin
|
config.action_dispatch.best_standards_support = :builtin
|
||||||
|
|
||||||
|
|
||||||
# config.middleware.use ExceptionNotifier,
|
config.middleware.use ExceptionNotifier,
|
||||||
# :email_prefix => "[R4_error]",
|
:email_prefix => "[R4_error]",
|
||||||
# :sender_address => %{"notifier" <redmine@rulingcom.com>},
|
:sender_address => %{"notifier" <redmine@rulingcom.com>},
|
||||||
# :exception_recipients => %w{chris@rulingcom.com}
|
:exception_recipients => %w{chris@rulingcom.com}
|
||||||
#
|
|
||||||
# config.action_mailer.delivery_method = :smtp
|
config.action_mailer.delivery_method = :smtp
|
||||||
# config.action_mailer.smtp_settings = {
|
config.action_mailer.smtp_settings = {
|
||||||
# :tls => true,
|
:tls => true,
|
||||||
# :enable_starttls_auto => true,
|
:enable_starttls_auto => true,
|
||||||
# :address => "smtp.gmail.com",
|
:address => "smtp.gmail.com",
|
||||||
# :port => '587',
|
:port => '587',
|
||||||
# :domain => "smtp.gmail.com",
|
:domain => "smtp.gmail.com",
|
||||||
# :authentication => "plain",
|
:authentication => "plain",
|
||||||
# :user_name => "redmine@rulingcom.com",
|
:user_name => "redmine@rulingcom.com",
|
||||||
# :password => "rulingredmine" }
|
:password => "rulingredmine" }
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ PrototypeR4::Application.routes.draw do
|
||||||
match '/site/update', :to => GithubApp
|
match '/site/update', :to => GithubApp
|
||||||
match '/purchase/:type', :to => CentralServerExchangeApp
|
match '/purchase/:type', :to => CentralServerExchangeApp
|
||||||
|
|
||||||
|
|
||||||
# routes for admin
|
# routes for admin
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
resources :assets
|
resources :assets
|
||||||
|
|
|
@ -106,7 +106,7 @@ module ParserBackEnd
|
||||||
c.define_tag 'content' do |tag|
|
c.define_tag 'content' do |tag|
|
||||||
ret = ''
|
ret = ''
|
||||||
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
|
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
|
||||||
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.title}/front_end/#{page.app_frontend_url}?inner=true'></div>"
|
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}?inner=true'></div>"
|
||||||
else
|
else
|
||||||
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }
|
part = page.page_parts.detect{ |p| p.name.to_s == tag.attr['name'].to_s }
|
||||||
ret << "<div id='#{tag.attr['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>"
|
ret << "<div id='#{tag.attr['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>"
|
||||||
|
|
|
@ -123,7 +123,7 @@ module ParserFrontEnd
|
||||||
c.define_tag 'content' do |tag|
|
c.define_tag 'content' do |tag|
|
||||||
ret = ''
|
ret = ''
|
||||||
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
|
if (tag.attributes["main"] == "true" && !page.module_app.nil?)
|
||||||
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.title}/front_end/#{page.app_frontend_url}"
|
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
|
||||||
ret << "/#{id}" if id
|
ret << "/#{id}" if id
|
||||||
ret << "?inner=true'></div>"
|
ret << "?inner=true'></div>"
|
||||||
else
|
else
|
||||||
|
|
|
@ -6,6 +6,6 @@
|
||||||
"intro": "A simple blog……",
|
"intro": "A simple blog……",
|
||||||
"update_info": "Some info",
|
"update_info": "Some info",
|
||||||
"create_date": "11-11-2011",
|
"create_date": "11-11-2011",
|
||||||
"app_pages": ["/panel/announcement/front_end/"],
|
"app_pages": ["bulletins"],
|
||||||
"enable_frontend": true
|
"enable_frontend": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,14 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationCon
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@bulletin_categorys = BulletinCategory.all
|
@bulletin_categorys = BulletinCategory.all
|
||||||
|
@bulletin_category = BulletinCategory.new(:display => 'List')
|
||||||
|
|
||||||
|
@url = panel_announcement_back_end_bulletin_categorys_path
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
format.xml { render :xml => @bulletins }
|
# format.xml { render :xml => @bulletins }
|
||||||
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -18,25 +22,47 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationCon
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # show.html.erb
|
format.html # show.html.erb
|
||||||
format.xml { render :xml => @bulletin_category }
|
# format.xml { render :xml => @bulletin_category }
|
||||||
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /bulletins/new
|
# GET /bulletins/new
|
||||||
# GET /bulletins/new.xml
|
# GET /bulletins/new.xml
|
||||||
def new
|
def new
|
||||||
@bulletin_category = BulletinCategory.new
|
@bulletin_category = BulletinCategory.new(:display => 'List')
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # new.html.erb
|
format.html # new.html.erb
|
||||||
format.xml { render :xml => @bulletin_category }
|
# format.xml { render :xml => @bulletin_category }
|
||||||
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def quick_edit
|
||||||
|
# debugger
|
||||||
|
|
||||||
|
@bulletin_category = BulletinCategory.find(params[:bulletin_category_id])
|
||||||
|
|
||||||
|
@url = panel_announcement_back_end_bulletin_category_path(@bulletin_category)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
# GET /bulletins/1/edit
|
# GET /bulletins/1/edit
|
||||||
def edit
|
def edit
|
||||||
@bulletin_category = BulletinCategory.find(params[:id])
|
@bulletin_category = BulletinCategory.find(params[:id])
|
||||||
@i18n_variable = @bulletin_category.i18n_variable
|
@i18n_variable = @bulletin_category.i18n_variable
|
||||||
|
|
||||||
|
@url = panel_announcement_back_end_bulletin_category_path(@bulletin_category)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.js
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /bulletins
|
# POST /bulletins
|
||||||
|
@ -46,12 +72,14 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationCon
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @bulletin_category.save
|
if @bulletin_category.save
|
||||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin_category), :notice => t('announcement.create_bulletin_success')) }
|
# format.html { redirect_to @bulletin_category, notice: 'Entry was successfully created.' }
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('announcement.create_bulletin_category_success')) }
|
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('announcement.create_bulletin_category_success')) }
|
||||||
format.xml { render :xml => @bulletin_category, :status => :created, :location => @bulletin_category }
|
# format.xml { render :xml => @bulletin_category, :status => :created, :location => @bulletin_category }
|
||||||
|
format.js
|
||||||
else
|
else
|
||||||
format.html { render :action => "new" }
|
format.html { render :action => "new" }
|
||||||
format.xml { render :xml => @bulletin_category.errors, :status => :unprocessable_entity }
|
# format.xml { render :xml => @bulletin_category.errors, :status => :unprocessable_entity }
|
||||||
|
format.js { render action: "new" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -61,14 +89,18 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationCon
|
||||||
def update
|
def update
|
||||||
@bulletin_category = BulletinCategory.find(params[:id])
|
@bulletin_category = BulletinCategory.find(params[:id])
|
||||||
|
|
||||||
|
@url = panel_announcement_back_end_bulletin_category_path(@bulletin_category)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @bulletin_category.update_attributes(params[:bulletin_category])
|
if @bulletin_category.update_attributes(params[:bulletin_category])
|
||||||
# format.html { redirect_to(panel_announcement_back_end_bulletin_category_url(@bulletin_category), :notice => t('bulletin_category.update_bulletin_category_success')) }
|
# format.html { redirect_to(panel_announcement_back_end_bulletin_category_url(@bulletin_category), :notice => t('bulletin_category.update_bulletin_category_success')) }
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('bulletin_category.update_bulletin_category_success')) }
|
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('bulletin_category.update_bulletin_category_success')) }
|
||||||
format.xml { head :ok }
|
# format.xml { head :ok }
|
||||||
|
format.js
|
||||||
else
|
else
|
||||||
format.html { render :action => "edit" }
|
format.html { render :action => "edit" }
|
||||||
format.xml { render :xml => @bulletin_category.errors, :status => :unprocessable_entity }
|
format.js { render :action => "edit" }
|
||||||
|
# format.xml { render :xml => @bulletin_category.errors, :status => :unprocessable_entity }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -81,7 +113,8 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationCon
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url) }
|
format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url) }
|
||||||
format.xml { head :ok }
|
# format.xml { head :ok }
|
||||||
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -120,19 +120,20 @@ class Panel::Announcement::BackEnd::BulletinsController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||||
format.xml { head :ok }
|
# format.xml { head :ok }
|
||||||
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def top_edit
|
# def top_edit
|
||||||
|
|
||||||
Bulletin.where(id: params[:id]).update_all( is_top: true )
|
# Bulletin.where(id: params[:id]).update_all( is_top: true )
|
||||||
respond_to do |format|
|
# respond_to do |format|
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
# format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
|
||||||
format.xml { head :ok }
|
# format.xml { head :ok }
|
||||||
end
|
# end
|
||||||
|
|
||||||
end
|
# end
|
||||||
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -6,15 +6,15 @@ class Bulletin
|
||||||
include Mongoid::MultiParameterAttributes
|
include Mongoid::MultiParameterAttributes
|
||||||
|
|
||||||
# field :category_id, :type => Integer
|
# field :category_id, :type => Integer
|
||||||
# field :title
|
field :title
|
||||||
has_one :title_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
# has_one :title_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
has_one :subtitle_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
# has_one :subtitle_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
has_one :text_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
# has_one :text_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
# field :subtitle
|
field :subtitle
|
||||||
# field :text
|
field :text
|
||||||
field :postdate , :type => Date
|
field :postdate , :type => Date
|
||||||
field :deadline , :type => Date
|
field :deadline , :type => Date
|
||||||
field :url
|
# field :url
|
||||||
field :create_user_id
|
field :create_user_id
|
||||||
field :update_user_id
|
field :update_user_id
|
||||||
|
|
||||||
|
@ -24,15 +24,18 @@ class Bulletin
|
||||||
|
|
||||||
belongs_to :bulletin_category
|
belongs_to :bulletin_category
|
||||||
|
|
||||||
# embeds_many :bulletin_files
|
embeds_many :bulletin_links, :cascade_callbacks => true
|
||||||
embeds_many :bulletin_files, :cascade_callbacks => true
|
embeds_many :bulletin_files, :cascade_callbacks => true
|
||||||
|
|
||||||
# has_many :bulletin_files, :autosave => true, :dependent => :destroy
|
# has_many :bulletin_files, :autosave => true, :dependent => :destroy
|
||||||
|
|
||||||
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
|
accepts_nested_attributes_for :bulletin_files, :allow_destroy => true
|
||||||
|
accepts_nested_attributes_for :bulletin_links, :allow_destroy => true
|
||||||
|
|
||||||
validates_presence_of :title_variable
|
# validates_presence_of :title_variable
|
||||||
|
validates_presence_of :title
|
||||||
|
|
||||||
|
after_save :save_bulletin_links
|
||||||
after_save :save_bulletin_files
|
after_save :save_bulletin_files
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,6 +82,14 @@ class Bulletin
|
||||||
self.is_top
|
self.is_top
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def save_bulletin_links
|
||||||
|
self.bulletin_links.each do |t|
|
||||||
|
if t.should_destroy
|
||||||
|
t.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def save_bulletin_files
|
def save_bulletin_files
|
||||||
self.bulletin_files.each do |t|
|
self.bulletin_files.each do |t|
|
||||||
if t.should_destroy
|
if t.should_destroy
|
||||||
|
|
|
@ -5,8 +5,11 @@ class BulletinCategory
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
# include Mongoid::MultiParameterAttributes
|
# include Mongoid::MultiParameterAttributes
|
||||||
|
|
||||||
|
PAYMENT_TYPES = [ "List", "Picture" ]
|
||||||
|
|
||||||
field :key
|
field :key
|
||||||
# field :name
|
field :display
|
||||||
|
|
||||||
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
|
||||||
|
|
||||||
has_many :bulletins
|
has_many :bulletins
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
class BulletinLink
|
||||||
|
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :url
|
||||||
|
field :name
|
||||||
|
|
||||||
|
field :should_destroy, :type => Boolean
|
||||||
|
|
||||||
|
embedded_in :bulletin
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
<tr id="<%= dom_id bulletin_category %>">
|
||||||
|
<td><%= bulletin_category.key %></td>
|
||||||
|
<% @site_valid_locales.each do |locale| %>
|
||||||
|
<td><%= bulletin_category.i18n_variable[locale] rescue nil %></td>
|
||||||
|
<% end %>
|
||||||
|
<td><%= bulletin_category.display %></td>
|
||||||
|
<td>
|
||||||
|
<%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(bulletin_category), :remote => true %> |
|
||||||
|
<%= link_to t('bulletin_category.quick_edit'), panel_announcement_back_end_bulletin_category_quick_edit_path(bulletin_category), :remote => true %> |
|
||||||
|
<%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(bulletin_category), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
|
@ -1,29 +1,37 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
<div class="bulletin_categorys">
|
<%= form_for(@bulletin_category, :remote => true, :url => @url) do |f| %>
|
||||||
<table border="0" cellspacing="0" cellpadding="0">
|
<%#= form_for(@bulletin_category, :remote => true, :url => panel_announcement_back_end_bulletin_category_path(@bulletin_category)) do |f| %>
|
||||||
<thead class="list_head">
|
|
||||||
<tr>
|
<div class="field">
|
||||||
<td><%= t('bulletin_category.key') %></td>
|
<%= f.label :key %><br />
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<%= f.text_field :key %>
|
||||||
<td><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></td>
|
</div>
|
||||||
<% end %>
|
|
||||||
</tr>
|
<div class="field">
|
||||||
</thead>
|
<%= f.label :name %><br />
|
||||||
<tbody>
|
|
||||||
<tr class="list_item">
|
|
||||||
<td><%= f.text_field :key %>
|
|
||||||
<%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %>
|
<%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<td><%= f.text_field locale, :style => "width:130px" %></td>
|
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
|
||||||
|
<%= f.text_field locale, :style => "width:130px" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</div>
|
||||||
</tbody>
|
|
||||||
</table>
|
<div class="field">
|
||||||
|
<%= f.label :display %> <br />
|
||||||
|
<%#= f.select :display, BulletinCategory::PAYMENT_TYPES, :prompt => 'Select a display method' %>
|
||||||
|
|
||||||
|
<%= f.radio_button :display, "List" %>List
|
||||||
|
<%#= f.label :display, 'list', :value => '1', :checked => @a %>
|
||||||
|
<%= f.radio_button :display, "Picture" %>Picture
|
||||||
|
<%#= f.label :display, 'picture', :value => '2', :checked => @b %>
|
||||||
|
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<%= f.submit %>
|
<%= f.submit %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :key %><br />
|
||||||
|
<%= f.text_field :key %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :name %><br />
|
||||||
|
<%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %>
|
||||||
|
<% @site_valid_locales.each do |locale| %>
|
||||||
|
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
|
||||||
|
<%= f.text_field locale, :style => "width:130px" %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :display %> <br />
|
||||||
|
<%#= f.select :display, BulletinCategory::PAYMENT_TYPES, :prompt => 'Select a display method' %>
|
||||||
|
|
||||||
|
<%= f.radio_button :display, "List" %>List
|
||||||
|
<%#= f.label :display, 'list', :value => '1', :checked => @a %>
|
||||||
|
<%= f.radio_button :display, "Picture" %>Picture
|
||||||
|
<%#= f.label :display, 'picture', :value => '2', :checked => @b %>
|
||||||
|
<br />顯示方式是設定在前台頁面時,資訊所呈現的樣式
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<%= f.submit %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
$('<%= j render :partial => 'bulletin_category', :collection => [@bulletin_category] %>').appendTo('#bulletin_categorys').hide().fadeIn();
|
||||||
|
$("#new_bulletin_category")[0].reset();
|
|
@ -0,0 +1 @@
|
||||||
|
$("#<%= dom_id @bulletin_category %>").remove();
|
|
@ -0,0 +1 @@
|
||||||
|
$("#form > form").replaceWith("<%= j render "form" %>");
|
|
@ -5,7 +5,7 @@
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
<li><%= link_to t('bulletin_category.new_announcement_class'), new_panel_announcement_back_end_bulletin_category_path, :class => 'seclink1' %></li>
|
<li><%#= link_to t('bulletin_category.new_announcement_class'), new_panel_announcement_back_end_bulletin_category_path, :class => 'seclink1' %></li>
|
||||||
</ul>
|
</ul>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
|
@ -17,28 +17,28 @@
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<table>
|
<table id="bulletin_categorys">
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= t('bulletin_category.key') %></th>
|
<th><%= t('bulletin_category.key') %></th>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
<% @site_valid_locales.each do |locale| %>
|
||||||
<th><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
<th><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<th><%= t('bulletin_category.display') %></th>
|
||||||
<th><%= t('bulletin.action') %></th>
|
<th><%= t('bulletin.action') %></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% @bulletin_categorys.each do |post| %>
|
<%# @bulletin_categorys.each do |post| %>
|
||||||
<tr>
|
<%= render :partial => 'bulletin_category', :collection => @bulletin_categorys %>
|
||||||
<td><%= post.key %></td>
|
<%# end %>
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<td><%= post.i18n_variable[locale] rescue nil %></td>
|
|
||||||
<% end %>
|
|
||||||
<td>
|
|
||||||
<%= link_to t('bulletin_category.edit'), edit_panel_announcement_back_end_bulletin_category_path(post) %> |
|
|
||||||
<%= link_to t('bulletin_category.delete'), panel_announcement_back_end_bulletin_category_path(post), :confirm => t('announcement.sure?'), :method => :delete %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
<h2>Add New</h2>
|
||||||
|
<div id="form"><%= render :partial => "form" %></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
$("#form > form").replaceWith("<%= j render "form" %>");
|
|
@ -0,0 +1,3 @@
|
||||||
|
$.each($(".quick_edit"),function(obj){ $(this).remove(); });
|
||||||
|
$("#<%= dom_id @bulletin_category %>").append("<div class='quick_edit'><%= j render "form" %></div>");
|
||||||
|
//$("#form > form").replaceWith("<%= j render "form" %>");
|
|
@ -0,0 +1,4 @@
|
||||||
|
$("#<%= dom_id @bulletin_category %>").replaceWith("<%= j render :partial => 'bulletin_category', :collection => [@bulletin_category] %>");
|
||||||
|
<% @bulletin_category = BulletinCategory.new(:display => 'List') # reset for new form %>
|
||||||
|
$(".edit_bulletin_category").replaceWith("<%= j render "form" %>")
|
||||||
|
$(".new_bulletin_category")[0].reset();
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
<div id="<%= "bulletin_#{bulletin_link.id}" if !bulletin_link.new_record? %>" class='list_item'>
|
||||||
|
<div class="field">
|
||||||
|
|
||||||
|
<%= f.label :link_url %>
|
||||||
|
<%= f.text_field :url %>
|
||||||
|
|
||||||
|
<%= f.label :link_name %>
|
||||||
|
<%= f.text_field :name %>
|
||||||
|
|
||||||
|
<span class="action">
|
||||||
|
<% if bulletin_link.new_record? %>
|
||||||
|
<a href="#" class="delete"><%= t(:delete) %></a>
|
||||||
|
<% else %>
|
||||||
|
<%= f.hidden_field :id %>
|
||||||
|
<a href="#" class="remove_existing_record"><%= t(:delete) %></a>
|
||||||
|
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
<tr id="<%= dom_id post %>">
|
||||||
|
<td></td>
|
||||||
|
<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td>
|
||||||
|
<td><%#= link_to post.title, panel_announcement_front_end_bulletin_path(post) %>
|
||||||
|
<%= link_to post.title, panel_announcement_back_end_bulletin_path(post) %>
|
||||||
|
</td>
|
||||||
|
<td><%= post.postdate %></td>
|
||||||
|
<td><%= (post.deadline) ? post.deadline : t('bulletin.no_deadline') %></td>
|
||||||
|
<td>
|
||||||
|
<%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(post) %> |
|
||||||
|
|
||||||
|
<%= link_to t(:set_top), eval("panel_announcement_back_end_bulletin_path(post, :authenticity_token => form_authenticity_token, :bulletin => {:is_top => true})"), :remote => true, :method => :put, :id => "disable_#{post.id}", :style => "display:#{post.is_top? ? 'none' : ''}", :class => 'switch' %>
|
||||||
|
<%= link_to t(:cancel_top), eval("panel_announcement_back_end_bulletin_path(post, :authenticity_token => form_authenticity_token, :bulletin => {:is_top => false})"), :remote => true, :method => :put, :id => "enable_#{post.id}", :style => "display:#{post.is_top? ? '' : 'none'}", :class => 'switch' %>
|
||||||
|
|
||||||
|
| <%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(post), :confirm => t('announcement.sure?'), :method => :delete, :remote => true %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
|
@ -18,35 +18,17 @@
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :title %><br />
|
<%= f.label :title %><br />
|
||||||
<%#= f.text_field :title %>
|
<%= f.text_field :title %>
|
||||||
<%= f.fields_for :title_variable, (@bulletin.new_record? ? @bulletin.build_title_variable : @bulletin.title_variable) do |f| %>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
|
|
||||||
<%= f.text_field locale, :style => "width:130px" %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :subtitle %><br />
|
<%= f.label :subtitle %><br />
|
||||||
<%#= f.text_area :subtitle, :rows => 10, :cols => 40 %>
|
<%= f.text_area :subtitle, :rows => 10, :cols => 40 %>
|
||||||
<%= f.fields_for :subtitle_variable, (@bulletin.new_record? ? @bulletin.build_subtitle_variable : @bulletin.subtitle_variable) do |f| %>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
|
|
||||||
<%= f.text_area locale, :rows => 10, :cols => 40 %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :text %><br />
|
<%= f.label :text %><br />
|
||||||
<%#= f.text_area :text, :rows => 10, :cols => 40 %>
|
<%= f.text_area :text, :rows => 10, :cols => 40 %>
|
||||||
<%= f.fields_for :text_variable, (@bulletin.new_record? ? @bulletin.build_text_variable : @bulletin.text_variable) do |f| %>
|
|
||||||
<% @site_valid_locales.each do |locale| %>
|
|
||||||
<%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %>
|
|
||||||
<%= f.text_area locale, :rows => 10, :cols => 40 %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
@ -62,11 +44,31 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<%= f.label :url %><br />
|
<%#= f.label :url %><br />
|
||||||
<%= f.text_field :url, :size => 60 %>
|
<%#= f.text_field :url, :size => 60 %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id='bulletin_links' class="bulletin_links_block <%= @class %>">
|
||||||
|
|
||||||
|
<div id='add_bulletin_link' class="info_input bulletin_links_block">
|
||||||
|
<h2>Bulletin links</h2>
|
||||||
|
<%= hidden_field_tag 'bulletin_link_field_count', @bulletin.bulletin_links.count %>
|
||||||
|
<a href="#" class="add"><%= t(:add) %></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%#= render :partial => 'link', :locals => { :bulletin_links => @bulletin.bulletin_links , :f => f} %>
|
||||||
|
|
||||||
|
|
||||||
|
<% @bulletin.bulletin_links.each_with_index do |bulletin_link, i| %>
|
||||||
|
<%#= fields_for "bulletin[bulletin_links][]", bulletin_link do |f| %>
|
||||||
|
<%= f.fields_for :bulletin_links, bulletin_link do |f| %>
|
||||||
|
<%= render :partial => 'bulletin_link', :object => bulletin_link, :locals => {:f => f, :i => i} %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id='bulletin_files' class="bulletin_files_block <%= @class %>">
|
<div id='bulletin_files' class="bulletin_files_block <%= @class %>">
|
||||||
|
|
||||||
|
@ -101,6 +103,12 @@
|
||||||
<% content_for :page_specific_javascript do %>
|
<% content_for :page_specific_javascript do %>
|
||||||
<%= javascript_include_tag "bulletin_form" %>
|
<%= javascript_include_tag "bulletin_form" %>
|
||||||
<script>
|
<script>
|
||||||
|
$('#add_bulletin_link a.add').live('click', function(){
|
||||||
|
var new_id = $(this).prev().attr('value');
|
||||||
|
var old_id = new RegExp("new_bulletin_links", "g");
|
||||||
|
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||||
|
$('#bulletin_links').append(("<%= escape_javascript(add_attribute 'bulletin_link', f, :bulletin_links) %>").replace(old_id, new_id));
|
||||||
|
});
|
||||||
$('#add_bulletin_file a.add').live('click', function(){
|
$('#add_bulletin_file a.add').live('click', function(){
|
||||||
var new_id = $(this).prev().attr('value');
|
var new_id = $(this).prev().attr('value');
|
||||||
var old_id = new RegExp("new_bulletin_files", "g");
|
var old_id = new RegExp("new_bulletin_files", "g");
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
$("#<%= dom_id @bulletin %>").remove();
|
|
@ -46,34 +46,16 @@
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= t('bulletin.status') %></th>
|
<th><%= t('bulletin.status') %></th>
|
||||||
<th><%= t('bulletin.postdate') %></th>
|
|
||||||
<th><%= t('bulletin.deadline') %></th>
|
|
||||||
<th><%= t('bulletin.category') %></th>
|
<th><%= t('bulletin.category') %></th>
|
||||||
<th><%= t('bulletin.title') %></th>
|
<th><%= t('bulletin.title') %></th>
|
||||||
|
<th><%= t('bulletin.postdate') %></th>
|
||||||
|
<th><%= t('bulletin.deadline') %></th>
|
||||||
<th><%= t('bulletin.action') %></th>
|
<th><%= t('bulletin.action') %></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% @bulletins.each do |post| %>
|
<% @bulletins.each do |post| %>
|
||||||
<tr>
|
<%= render :partial => 'bulletins', :locals => {:post => post} %>
|
||||||
<td></td>
|
|
||||||
<td><%= post.postdate %></td>
|
|
||||||
<td><%= (post.deadline) ? post.deadline : t('bulletin.no_deadline') %></td>
|
|
||||||
<td><%= post.bulletin_category.i18n_variable[I18n.locale] %></td>
|
|
||||||
<td><%#= link_to post.title, panel_announcement_front_end_bulletin_path(post) %>
|
|
||||||
<%= link_to post.title_variable[I18n.locale], panel_announcement_back_end_bulletin_path(post) %>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<%= link_to t('bulletin.edit'), edit_panel_announcement_back_end_bulletin_path(post) %> |
|
|
||||||
|
|
||||||
<%= link_to t(:set_top), eval("panel_announcement_back_end_bulletin_path(post, :authenticity_token => form_authenticity_token, :bulletin => {:is_top => true})"), :remote => true, :method => :put, :id => "disable_#{post.id}", :style => "display:#{post.is_top? ? 'none' : ''}", :class => 'switch' %>
|
|
||||||
<%= link_to t(:cancel_top), eval("panel_announcement_back_end_bulletin_path(post, :authenticity_token => form_authenticity_token, :bulletin => {:is_top => false})"), :remote => true, :method => :put, :id => "enable_#{post.id}", :style => "display:#{post.is_top? ? '' : 'none'}", :class => 'switch' %>
|
|
||||||
|
|
||||||
| <%= link_to t('bulletin.delete'), panel_announcement_back_end_bulletin_path(post), :confirm => t('announcement.sure?'), :method => :delete %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b><%= t('announcement.title') %></b>
|
<b><%= t('announcement.title') %></b>
|
||||||
<%= @bulletin.title_variable[I18n.locale] %>
|
<%= @bulletin.title %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
|
<%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %>
|
||||||
|
@ -25,11 +25,11 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b><%= t('announcement.subtitle') %></b>
|
<b><%= t('announcement.subtitle') %></b>
|
||||||
<%= @bulletin.subtitle_variable[I18n.locale] %>
|
<%= @bulletin.subtitle %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b><%= t('announcement.text') %></b>
|
<b><%= t('announcement.text') %></b>
|
||||||
<%= @bulletin.text_variable[I18n.locale] %>
|
<%= @bulletin.text %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -33,15 +33,15 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<li>
|
<li>
|
||||||
<b><%= t('announcement.file') %></b>
|
<b><%= t('announcement.link') %></b>
|
||||||
<% @bulletin.bulletin_files.each do | bfile | %>
|
<% @bulletin.bulletin_links.each do | blink | %>
|
||||||
<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
<%= link_to blink.name, blink.url, :target => '_blank' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<% if @bulletin.url? %>
|
<b><%= t('announcement.file') %></b>
|
||||||
<b><%= t('announcement.url') %></b>
|
<% @bulletin.bulletin_files.each do | bfile | %>
|
||||||
<%= link_to @bulletin.url, @bulletin.url, :target => '_blank' %>
|
<%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -5,17 +5,17 @@ Rails.application.routes.draw do
|
||||||
namespace :back_end do
|
namespace :back_end do
|
||||||
root :to => "bulletins#index"
|
root :to => "bulletins#index"
|
||||||
resources :bulletins
|
resources :bulletins
|
||||||
resources :bulletin_categorys, :controller => 'bulletin_categorys'
|
resources :bulletin_categorys, :controller => 'bulletin_categorys' do
|
||||||
|
match "quick_edit/:bulletin_category_id" => "bulletin_categorys#quick_edit" ,:as => :quick_edit
|
||||||
|
end
|
||||||
end
|
end
|
||||||
namespace :front_end do
|
namespace :front_end do
|
||||||
root :to => "bulletins#index"
|
root :to => "bulletins#index"
|
||||||
resources :bulletins
|
resources :bulletins
|
||||||
match "show/:id" => "bulletins#show" ,:as => :bulletin
|
|
||||||
end
|
end
|
||||||
namespace :widget do
|
namespace :widget do
|
||||||
root :to => "bulletins#index"
|
root :to => "bulletins#index"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
match "/appfront/*path" => redirect("/panel/*path")
|
|
||||||
end
|
end
|
||||||
|
|
Reference in New Issue