Merge commit 'fc702a6210d901cd3beea220e72f71a3b7f7d41e' into sidebar_config

Conflicts:
	app/controllers/admin/page_parts_controller.rb
	app/controllers/default_widget_controller.rb
	app/uploaders/gprs_uploader.rb
	app/uploaders/location_uploader.rb
	app/views/admin/page_parts/_module_widget.html.erb
	app/views/admin/page_parts/reload_widget_styles.js.erb
	app/views/admin/page_parts/reload_widgets.js.erb
	app/views/layouts/_side_bar_content.html.erb
	config/locales/zh_tw.yml
	lib/parsers/parser_front_end.rb
	vendor/built_in_modules/announcement/init.rb
	vendor/built_in_modules/gprs/app/assets/javascripts/panel/gprs/back_end/locations.js
	vendor/built_in_modules/gprs/app/assets/stylesheets/panel/gprs/back_end/locations.css
	vendor/built_in_modules/gprs/app/controllers/panel/gprs/back_end/locations_controller.rb
	vendor/built_in_modules/gprs/app/views/panel/gprs/back_end/locations/index.html.erb
	vendor/built_in_modules/gprs/test/functional/panel/gprs/back_end/locations_controller_test.rb
	vendor/built_in_modules/location/README.rdoc
	vendor/built_in_modules/location/app/assets/javascripts/panel/gprs/back_end/locations.js
	vendor/built_in_modules/location/app/assets/javascripts/panel/location/back_end/locations.js
	vendor/built_in_modules/location/app/assets/stylesheets/panel/gprs/back_end/locations.css
	vendor/built_in_modules/location/app/assets/stylesheets/panel/location/back_end/locations.css
	vendor/built_in_modules/location/app/controllers/panel/location/back_end/locations_controller.rb
	vendor/built_in_modules/location/app/controllers/panel/locations/back_end/locations_controller.rb
	vendor/built_in_modules/location/app/models/location.rb
	vendor/built_in_modules/location/app/uploaders/locations_uploader.rb
	vendor/built_in_modules/location/app/views/panel/location/back_end/locations/index.html.erb
	vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/_form.html.erb
	vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/edit.html.erb
	vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/index.html.erb
	vendor/built_in_modules/location/app/views/panel/locations/back_end/locations/new.html.erb
	vendor/built_in_modules/location/config/routes.rb
	vendor/built_in_modules/location/lib/location.rb
	vendor/built_in_modules/location/location.gemspec
	vendor/built_in_modules/location/test/functional/panel/gprs/back_end/locations_controller_test.rb
	vendor/built_in_modules/location/test/functional/panel/location/back_end/locations_controller_test.rb
This commit is contained in:
Fu Matthew committed 2013-01-24 16:30:02 +08:00
commit bfaa22052f
248 files changed
+6732 -2502

No files matched your search

+2 -1
View File
@@ -40,9 +40,10 @@ class Admin::InfosController < ApplicationController
@attribute.update_attributes(params[:info])
@attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true}
respond_to do |format|
format.html { redirect_to :action => :index }
format.html { redirect_to(edit_admin_info_path(params[:id])) }
format.js { render 'admin/attributes/toggle_enable' }
end
end
def destroy
@@ -3,38 +3,12 @@ class Admin::ModuleAppsController < ApplicationController
before_filter :user_has_sub_manager_privilege?, :only => [ :assign_sub_manager, :remove_sub_manager ]
layout "new_admin"
helper Admin::PagePartsHelper
def index
@module_apps = ModuleApp.all.entries
end
def reload_frontend_pages
@categories =[]
@module_app = ModuleApp.find(params[:id])
@frontend_path = @module_app.widgets.keys[0] if ( !@module_app.widgets.blank? && @module_app.widgets[0].blank? )
@frontend_style = @module_app.widgets[@frontend_path] if ( !@frontend_path.blank? )
case @module_app.key
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'news'
@categories = NewsBulletinCategory.all
@tags = NewsTag.all
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
when 'archive'
@categories = ArchiveFileCategory.all
@tags = ArchiveTag.all
end
respond_to do |format|
format.js {}
end
end
def module_auth_proc
@module_app = ModuleApp.find(params[:id])
@@ -136,7 +110,6 @@ class Admin::ModuleAppsController < ApplicationController
end
#user is not permited to do that
flash[:notice] = t('app_auth.operation_not_permitted')
render :nothing => true, :status => 403
end
render :nothing => true,:status => 403
end
end
+23 -12
View File
@@ -25,7 +25,8 @@ class Admin::PagePartsController < ApplicationController
def edit
@part = PagePart.find(params[:id])
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@module_app = @part.module_app ? @part.module_app : @module_apps[0]
@module_app = @part.module_app ? @part.module_app : nil
@user_choose = @part.widget_path
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
@tag_objects = @r_tag.classify.constantize.all rescue nil
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
@@ -37,11 +38,12 @@ class Admin::PagePartsController < ApplicationController
# @widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
# end
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
@widget_path = @part.widget_path ? @part.widget_path : (@module_app.widgets.keys[0] rescue nil)
if @module_app.widgets.any?{|b| b.class == Array}
if @module_app && @module_app.widgets.any?{|b| b.class == Array}
@widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
end
# TODO 應該要有一些東西來決定 @categories @tags
# case @module_app.key
# when 'announcement'
@@ -55,7 +57,7 @@ class Admin::PagePartsController < ApplicationController
# when 'archive'
# @categories = ArchiveFileCategory.all
# @tags = ArchiveTag.all
# end
# end if @module_app
end
@@ -69,6 +71,11 @@ class Admin::PagePartsController < ApplicationController
params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] ) if params[:page_part][:widget_field]
params[:page_part][:widget_field_type] = nil
if params[:page_part][:module_app].blank?
params[:page_part][:module_app] = nil
params[:page_part][:kind] = nil
end
if @part.update_attributes(params[:page_part])
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
@@ -99,13 +106,13 @@ class Admin::PagePartsController < ApplicationController
end
def reload_widgets
@part = PagePart.find params[:part_id]
@part = PagePart.find params[:id]
@categories =[]
@module_app = ModuleApp.find(params[:id])
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@widget_path = @module_app.widgets.keys[0] if ( @module_app.widgets[0].blank? )
@widget_path = @module_app.widgets.keys[0] if (@module_app && @module_app.widgets[0].blank? )
@widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil?
@widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? )
case @module_app.key
when 'announcement'
@@ -113,15 +120,16 @@ class Admin::PagePartsController < ApplicationController
@tags = AnnouncementTag.all
when 'gallery'
@albums = GalleryAlbum.all
@tags = []
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
when 'archive'
@categories = ArchiveFileCategory.all
@tags = ArchiveTag.all
end
end if @module_app
@part.widget_path = @module_app.widgets.first if @module_app.needs_to_widget_option?
@part.widget_path = @module_app.widgets.first if( @module_app && @module_app.needs_to_widget_option?)
respond_to do |format|
format.js {}
end
@@ -129,8 +137,11 @@ class Admin::PagePartsController < ApplicationController
def reload_widget_styles
@module_app = ModuleApp.find(params[:module_app_id])
style_ary = @module_app.get_widget_style[params[:id]]
@widget_style = style_ary[:style] unless style_ary.nil?
@part = PagePart.find params[:id]
@user_choose =@widget_path= params[:frontend]
@widget_style = @module_app.widgets[@widget_path]
respond_to do |format|
format.js {}
+53 -10
View File
@@ -1,5 +1,5 @@
class Admin::PagesController < Admin::ItemsController
helper Admin::PagePartsHelper
def show
@item = Page.find(params[:id])
respond_to do |format|
@@ -19,15 +19,21 @@ class Admin::PagesController < Admin::ItemsController
end
def edit
@item = Page.find(params[:id])
@item = @page =Page.find(params[:id])
@user_choose = @item.app_frontend_url
@apps = ModuleApp.excludes(app_pages: nil).entries
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@designs = Design.all.entries
@design = @item.design ? @item.design : @designs.first
@app_frontend_urls = @item.module_app.app_pages if @item.module_app
if @item.module_app
@app_frontend_urls = @item.module_app.app_pages
@app_frontend_urls << 'default_widget' if @item.module_app.has_default_widget?
end
if @item.module_app
@module_app = @item.module_app
@@ -84,13 +90,13 @@ class Admin::PagesController < Admin::ItemsController
def update
@item = Page.find(params[:id])
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
end
params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] ) if params[:page][:frontend_field]
params[:page][:frontend_field_type] = nil
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
end
params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] ) if params[:page][:frontend_field]
params[:page][:frontend_field_type] = nil
if @item.update_attributes(params[:page])
flash[:notice] = t('update.success.page')
respond_to do |format|
@@ -123,7 +129,44 @@ class Admin::PagesController < Admin::ItemsController
format.js { @item = @item.parent }
end
end
def reload_front_end_setting
@page = Page.find params[:id]
@module_app = ModuleApp.find params[:module_app_id]
@chosen_frontend = @user_choose = params[:frontend]
end
def reload_frontend_pages
@page = Page.find params[:id] rescue nil
# @categories =[]
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages
@app_frontend_urls << 'default_widget' if(@module_app && @module_app.has_default_widget?)
case (@module_app.nil? ? nil : @module_app.key )
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'news'
@categories = NewsBulletinCategory.all
@tags = NewsTag.all
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
when 'archive'
@categories = ArchiveFileCategory.all
@tags = ArchiveTag.all
else
@categories = []
@tags = []
end
respond_to do |format|
format.js {}
end
end
def reload_themes
@design = Design.find(params[:id])
@themes = @design.themes
+151 -13
View File
@@ -3,7 +3,7 @@ class Admin::RolesController < ApplicationController
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
before_filter :set_attribute, :only => [:index, :show, :new, :edit, :role_field, :sub_role, :add_sub_role, :edit_sub_role, :sub_role_field]
helper Admin::AttributeValuesViewHelper
def index
@@ -13,11 +13,98 @@ class Admin::RolesController < ApplicationController
def show
end
def role_field
@field_name = 'role'
@attribute = Role.find(params[:role_id])
end
def sub_role
@attribute = Role.find(params[:role_id])
@attribute_fields_upper_object = @attribute.sub_roles
end
def add_sub_role
@attribute = Role.find(params[:role_id])
# @sub_attribute = Role.find(params[:role_id])
@sub_attribute = SubRole.new
@sub_attribute.role_id = params[:role_id]
end
def edit_sub_role
@sub_attribute = SubRole.find(params[:role_id])
@attribute = Role.find(@sub_attribute.role_id)
@sub_attribute.role_id = @sub_attribute.role_id
end
def sub_role_field
@field_name = 'sub_role'
@sub_attribute = SubRole.find(params[:role_id])
@attribute = Role.find(@sub_attribute.role_id)
end
def add_attribute_field
if params[:sub_role]
@field_name = 'sub_role'
attribute = SubRole.find(params[:sub_role][:id]) rescue nil
@attribute_field_counter = attribute.attribute_fields.count
@attribute_field = attribute.attribute_fields.build
@attribute_field.save
@attribute_field[:af_count] = @attribute_field_counter
@attribute = SubRole.find(params[:sub_role][:id])
else
@field_name = 'role'
attribute = Role.find(params[:role_id]) rescue nil
@attribute_field_counter = attribute.attribute_fields.count
@attribute_field = attribute.attribute_fields.build
@attribute_field.save
@attribute_field[:af_count] = @attribute_field_counter
@attribute = Role.find(params[:role_id])
end
respond_to do |format|
format.js { render 'add_attribute_field' }
end
end
def new
@attribute = Role.new
render :template => 'admin/attributes/new'
if !params[:parent_id]
render :template => 'admin/attributes/new'
end
end
def edit
@@ -27,24 +114,75 @@ class Admin::RolesController < ApplicationController
end
def create
@attribute = Role.new(params[:role])
@attribute.save
redirect_to :action => :index
if params[:sub_role]
@sub_role = SubRole.new(params[:sub_role])
# @sub_role.role_id = params[:id]
respond_to do |format|
if @sub_role.save
format.html { redirect_to(admin_role_sub_role_url(params[:sub_role][:role_id])) }
end
end
else
@attribute = Role.new(params[:role])
@attribute.save
redirect_to :action => :index
end
end
def update
@attribute = Role.find(params[:id])
@attribute.update_attributes(params[:role])
respond_to do |format|
format.html { redirect_to :action => :index }
format.js { render 'admin/attributes/toggle_enable' }
if params[:sub_role]
@sub_role = SubRole.find(params[:sub_role][:id])
@sub_role.update_attributes(params[:sub_role])
@sub_role.attribute_fields.each{|t| t.destroy if t["to_delete"] == true}
respond_to do |format|
format.html { redirect_to(admin_role_sub_role_url(@sub_role.role_id)) }
format.js { render 'toggle_enable' }
end
else
@attribute = Role.find(params[:id])
@attribute.update_attributes(params[:role])
@attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true}
respond_to do |format|
format.html { redirect_to :action => :index }
format.js { render 'admin/attributes/toggle_enable' }
end
end
end
def destroy
@attribute = Role.find(params[:id])
@attribute.destroy
redirect_to :action => :index
if params[:sub_role]
@sub_role = SubRole.find(params[:sub_role][:id])
respond_to do |format|
if @sub_role.destroy
format.html { redirect_to(admin_role_sub_role_url(@sub_role.role_id)) }
end
end
else
@attribute = Role.find(params[:id])
@attribute.destroy
redirect_to :action => :index
end
end
protected
@@ -0,0 +1,4 @@
class Admin::SubRolesController < RolesController
end
+9 -3
View File
@@ -11,8 +11,8 @@ class ApplicationController < ActionController::Base
rescue_from PageError, :with => :render_page_error
layout :layout_by_resource
helper :admin
helper :admin, :orbit_form
before_filter :set_locale, :set_site, :prepare_for_mobile
helper_attr :site_valid_locales
@@ -251,7 +251,13 @@ class ApplicationController < ActionController::Base
def prepare_for_mobile
if @site.mobile_on
session[:mobile_param] = params[:mobile] if params[:mobile]
session[:mobile_param] = if request.path =~ /mobile/
'1'
elsif params[:mobile]
params[:mobile]
else
session[:mobile_param]
end
request.format = :mobile if mobile_device?
end
end
+27 -16
View File
@@ -1,7 +1,12 @@
class DefaultWidgetController< OrbitWidgetController
def front_end_available(var)
@page_part = PagePart.find params[:part_id]
@page_part = case params[:item_type]
when "page"
Page.find params[:page_id]
when "page_part"
PagePart.find params[:part_id]
end
@page_part.module_app.enable_frontend?
end
@@ -9,23 +14,29 @@ class DefaultWidgetController< OrbitWidgetController
@tag_class = nil
@default_widget = @page_part.module_app.get_default_widget
@widget_image_field = @default_widget[:image]
data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
@widget_image_field = @default_widget["image"] || @default_widget[:image]
data_limit = case @page_part
when Page
@fields = @page_part.frontend_field
@page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
when PagePart
@fields = @page_part.widget_field
@page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
end
@data = eval(@default_widget["query"]).limit(data_limit).includes(@widget_image_field)
@fields = @page_part.widget_field
case params[:type]
when "typeA"
@tag_class = 'defulat_widget_typeA'
render "typeA"
when /typeB_/
@tag_class = "defulat_widget_#{params[:type]}"
render "typeB"
when "typeC"
@tag_class = 'defulat_widget_typeC'
render "typeC"
end
when "typeA"
@tag_class = 'default_widget_typeA'
render "typeA"
when /typeB_/
@tag_class = "default_widget_#{params[:type]}"
render "typeB"
when "typeC"
@tag_class = 'default_widget_typeC'
render "typeC"
end
end
end
@@ -1,63 +0,0 @@
class Desktop::CoAuthorRelationsController < ApplicationController
def index
@co_author_relations = CoAuthorRelation.all
new
respond_to do |format|
format.html {render layout: false }
end
end
def edit
@co_author_relation = CoAuthorRelation.find(params[:id])
respond_to do |format|
format.html { render :layout => false}
end
end
def new
@co_author_relation = CoAuthorRelation.new
end
def create
@co_author_relation = CoAuthorRelation.new(params[:co_author_relation])
@co_author_relations = CoAuthorRelation.all
if @co_author_relation.save
newv = render_to_string partial: "show_form", object: @co_author_relations
render json: {success: true, msg: "New Relation successfully saved!", newvalue: newv}.to_json
else
error_msg = @co_author_relation.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def update
@co_author_relation = CoAuthorRelation.find(params[:id])
if @co_author_relation.update_attributes(params[:co_author_relation])
@co_author_relations = CoAuthorRelation.all
newv = render_to_string partial: "show_form", object: @co_author_relations
render json: {success: true, msg: "New Relation successfully updated!", newvalue: newv}.to_json
else
error_msg = @co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def destroy
@co_author_relation = CoAuthorRelation.find(params[:id])
@co_author_relation.destroy
reset_co_author_relation
render :json => {success: true, msg: "deleted successfully!"}
end
private
def reset_co_author_relation
co_author = CoAuthor.where(co_author_relations_id: @co_author_relation.id)
co_author.map do |c|
c.update_attributes(co_author_relations_id: nil)
end
end
end
@@ -1,59 +0,0 @@
class Desktop::CoAuthorsController < ApplicationController
def index
nils, not_nils = CoAuthor.where(name_id: current_user.id)\
.asc(:co_author).partition{|p| p.email.nil?}
@co_authors = not_nils + nils
@co_author_relations = CoAuthorRelation.all
respond_to do |format|
format.html { render :layout => false}
end
end
def new
@co_author = CoAuthor.new
@co_author_relations = CoAuthorRelation.all
respond_to do |format|
format.html { render :layout => false}
end
end
def edit
@co_author = CoAuthor.find(params[:id])
@co_author_relations = CoAuthorRelation.all
respond_to do |format|
format.html { render :layout => false}
end
end
def create
@co_author = CoAuthor.new(params[:co_author])
@co_author.name_id= current_user.id
if @co_author.save
render json: {success:true, msg: t('create.sucess.co_author')}.to_json
else
error_msg = @co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def update
@co_author = CoAuthor.find(params[:id])
if @co_author.update_attributes(params[:co_author])
render json: {success:true, msg: t('update.sucess.co_author')}.to_json
else
error_msg = @co_author.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def destroy
@co_author = CoAuthor.find(params[:id])
@co_author.destroy
render :json => {success: true, msg: "Co-author deleted successfully!"}
end
end
@@ -1,18 +0,0 @@
class Desktop::JournalListsController < ApplicationController
def index
level_types = JournalLevelType.all
all_journal_lists = WritingJournal.where(create_user_id: current_user.id)
all_journal_lists = all_journal_lists.map do |j|
[ j.journal_title,
j.journal_level_type_ids.map do |type|
level_types.find(type).title
end]
end
@journal_lists = all_journal_lists.uniq
respond_to do |format|
format.html { render :layout => false}
end
end
end
@@ -1,107 +0,0 @@
class Desktop::JournalPagesController < ApplicationController
def index
@writing_journal = WritingJournal.where(create_user_id: current_user.id)
@level_types = JournalLevelType.all
respond_to do |format|
format.html { render :layout => false}
end
end
def new
@writing_journal = WritingJournal.new
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types= JournalPaperType.all
@co_author_candidate =
CoAuthor.where(name_id: current_user.id).map{|c|c.co_author}
@journal_candidate =
WritingJournal.where(create_user_id: current_user.id).map{|j|j.journal_title}.uniq
respond_to do |format|
format.html { render :layout => false}
end
end
def edit
@writing_journal = WritingJournal.find(params[:id])
@level_types = JournalLevelType.all
@author_types = JournalAuthorType.all
@paper_types= JournalPaperType.all
respond_to do |format|
format.html { render :layout => false}
end
end
def create
params[:writing_journal][:create_user_id] = current_user.id
@writing_journal = WritingJournal.new(params[:writing_journal])
if @writing_journal.save
render json: {success: true, msg: t('create.success.paper')}.to_json
else
error_msg = @writing_journal.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def update
params[:writing_journal][:update_user_id] = current_user.id
@writing_journal= WritingJournal.find(params[:id])
if @writing_journal.update_attributes(params[:writing_journal])
render json: {success: true, msg: t('update.success.paper')}.to_json
else
error_msg = @writing_journal.errors.full_messages.join("<br />")
render json: {success: false, msg: error_msg}.to_json
end
end
def check_file_type file
if not file.nil?
file_type = MIME::Types.type_for(file).first.to_s.split("/")[1]
file_type = "/assets/ft-icons/#{file_type}/#{file_type}-48_32.png"
else
file_type = ""
end
end
def destroy
@writing_journal = WritingJournal.find(params[:id])
@writing_journal.destroy
render :json => {success: true, msg: t('delete.success.paper')}
end
def get_journals_json
publications = WritingJournal.where(create_user_id: current_user.id)
sort_publications= Hash.new
data = Array.new
publications.each do |publication|
if sort_publications[publication.journal_title].nil?
sort_publications[publication.journal_title] = Array.new
end
sort_publications[publication.journal_title] <<
{ title: publication.paper_title,
keywords: publication.keywords,
abstract: publication.abstract,
coauthors: publication.authors,
year: publication.year,
url_edit: edit_desktop_journal_page_path(publication),
url_delete: desktop_journal_page_path(publication),
files: publication.writing_journal_files.collect{|file|
{title: file.title, url: file.file.url, icon: check_file_type(file.file.url)}
}
}
end
sort_publications.each do |journal, papers|
data << {title: journal, papers: papers}
end
render json: JSON.pretty_generate(data)
end
end
+3 -3
View File
@@ -117,8 +117,8 @@ class DesktopController< ApplicationController
widge = DesktopWidget.find(tile.desktop_widget_id.to_s)
# data_content = widge.widget_layout.file
data_content = "/desktop/widget_layout?id="+tile.desktop_widget_id.to_s
jsfile = widge.javascripts.collect{|js| js.file}
cssfile = widge.css_default.file
jsfile = widge.javascripts.collect{|js| js.file.as_json[:file]}
cssfile = widge.css_default.file.as_json[:file]
shape = widge.shape
title = widge.name
else
@@ -212,4 +212,4 @@ class DesktopController< ApplicationController
render :xml=>feed
end
end
end
@@ -1,9 +1,9 @@
require 'mime/types'
class DesktopPublicationsController< ApplicationController
def journal_p
render "desktop/journal_p", :layout => false
end
#def journal_p
# render "desktop/journal_p", :layout => false
#end
def books
render "desktop/books", :layout => false
+4
View File
@@ -28,6 +28,10 @@ class FrontController < ApplicationController
@page_id = params[:page_id]
end
def show_inner_ad_image
@ad_image = AdImage.find(params[:id]) rescue nil
@ad_images = AdImage.all
end
private
+8
View File
@@ -2,6 +2,8 @@ class MobileController < ApplicationController
layout 'mobile'
before_filter :no_footer_for_app
def index
date_now = Time.now
@bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15)
@@ -49,4 +51,10 @@ class MobileController < ApplicationController
@page_title = @page_context.page.title
end
protected
def no_footer_for_app
@no_footer = true if request.path.starts_with?("/app")
end
end
-1
View File
@@ -65,7 +65,6 @@ class PagesController < ApplicationController
def get_item
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
if !params[:category_id].blank? && !params[:tag_id].blank?
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => params[:tag_id]})
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => ''}) unless @item