diff --git a/app/assets/images/-sign-in-logo.png b/app/assets/images/-sign-in-logo.png new file mode 100644 index 000000000..53756c7c3 Binary files /dev/null and b/app/assets/images/-sign-in-logo.png differ diff --git a/app/assets/images/orbit-bar.png b/app/assets/images/orbit-bar.png index 160b9d781..4b2a55852 100644 Binary files a/app/assets/images/orbit-bar.png and b/app/assets/images/orbit-bar.png differ diff --git a/app/assets/images/sign-in-logo.png b/app/assets/images/sign-in-logo.png index 53756c7c3..a3148babd 100644 Binary files a/app/assets/images/sign-in-logo.png and b/app/assets/images/sign-in-logo.png differ diff --git a/app/assets/javascripts/orbit-1.0.js b/app/assets/javascripts/orbit-1.0.js index 30e8fbe36..b1ac99937 100644 --- a/app/assets/javascripts/orbit-1.0.js +++ b/app/assets/javascripts/orbit-1.0.js @@ -1,6 +1,5 @@ var viewportwidth, viewportheight; - console.log($(window).height()) function resize() { viewportheight=$(window).height(); viewportwidth=$(window).width(); @@ -15,9 +14,9 @@ $(document).ready(function(){ placement: "left" }); + $(document).on('click', '.privacy', function() { - console.log($(this).val()); switch ($(this).val()) { case 'true': $(this).parents('.controls').children('.select-role').slideUp(300); @@ -53,15 +52,12 @@ $(document).ready(function(){ $orbitBar = $('#orbit-bar').height(), $mainSidebar = $('#main-sidebar').width()+5, $formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right")); - console.log($orbitBar); - console.log("ready"+$(window).height()); $('#main-sidebar').css("height", viewportheight-$orbitBar); $('#main-sidebar .viewport').css("height", viewportheight-$orbitBar); $('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget); $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16); $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft); $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding); - $('#bulletin_pagination').css("width", viewportwidth-$mainSidebar); $('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)}); $('.detal-list').tinyscrollbar(); mainTablePosition(); @@ -82,14 +78,12 @@ $(window).resize(function(){ $orbitBar = $('#orbit-bar').height(), $mainSidebar = $('#main-sidebar').width()+5, $formActionPadding = parseInt($('.form-fixed').css("padding-left"))+parseInt($('.form-fixed').css("padding-right")); - console.log(viewportheight); $('#main-sidebar').css("height", viewportheight-$orbitBar); $('#main-sidebar .viewport').css("height", viewportheight-$orbitBar); $('#post-body').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget); $('.post-title').css("width", viewportwidth-$mainWrapMarginLeft-$subWiget-16); $('#main-wrap .subnav').css("width", viewportwidth-$mainWrapMarginLeft); $('.form-fixed').css("width", viewportwidth-$mainWrapMarginLeft-$formActionPadding); - $('#bulletin_pagination').css("width", viewportwidth-$mainSidebar); $('#main-sidebar').tinyscrollbar({size:(viewportheight-$orbitBar-4)}); mainTablePosition(); }); @@ -118,5 +112,4 @@ $(window).scroll(function () { $(".table-label").css({left:$winLeft*-1} ); //$(".table-label").css({left:$mainWrapMarginLeft+($winLeft*-1)} ); //$("#main-wrap > .subnav").css({width:$subnavWidth+($winLeft)} ); - //console.log($mainWrapMarginLeft+($winLeft*-1)+5); }); diff --git a/app/assets/javascripts/orbit-bar-search.js b/app/assets/javascripts/orbit-bar-search.js index 26f44d843..7ef1dd055 100644 --- a/app/assets/javascripts/orbit-bar-search.js +++ b/app/assets/javascripts/orbit-bar-search.js @@ -1,3 +1,9 @@ + +$(document).ready(function(){ + $('.search').tooltip({ + placement: "bottom" + }); +}); $(document).on('click', '.orbit-bar-search', function (){ if ($(this).parents('.search').hasClass('visible')){ $(this).parents('.search').stop().animate({ diff --git a/app/assets/javascripts/orbit_bar.js b/app/assets/javascripts/orbit_bar.js index 06c3113dc..e9b1b4ea2 100644 --- a/app/assets/javascripts/orbit_bar.js +++ b/app/assets/javascripts/orbit_bar.js @@ -4,4 +4,4 @@ $(document).ready(function() { $('body').prepend($(this).html()); $(this).remove(); }); -}); \ No newline at end of file +}); diff --git a/app/assets/stylesheets/bootstrap.css.erb b/app/assets/stylesheets/bootstrap.css.erb index 40b3afca2..62a0afe8e 100644 --- a/app/assets/stylesheets/bootstrap.css.erb +++ b/app/assets/stylesheets/bootstrap.css.erb @@ -2701,8 +2701,11 @@ button.btn.small, input[type="submit"].btn.small { .pagination .current{ border-left-width: 1px; } +.pagination a { + background-color: #FFFFFF; +} .pagination a:hover, .pagination .active a { - background-color: #f5f5f5; + background-color: #e8e8e8; } .pagination .active a { color: #999999; diff --git a/app/assets/stylesheets/inc/permission-checkbox.css.erb b/app/assets/stylesheets/inc/permission-checkbox.css.erb index 9e61df20b..7e3f5bffa 100644 --- a/app/assets/stylesheets/inc/permission-checkbox.css.erb +++ b/app/assets/stylesheets/inc/permission-checkbox.css.erb @@ -10,22 +10,25 @@ } .checkbox{ padding: 5px; - margin: 5px 5px 10px; + margin: 0; display: inline-block; color:#777777; text-shadow: 0 1px 0px rgba(255,255,255,.4); - border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; height: 30px; position: relative; cursor: pointer; - background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); + border-style: solid; + border-width: 0px 1px 1px 0; + border-color: #dfdfdf; + /*background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px;*/ } .checkbox .check-icon { display: none; @@ -40,7 +43,7 @@ cursor: pointer; font-family: helvetica; font-size: 12px; - line-height: 30px; + line-height: 15px; padding: 0 10px 0 40px; color: #333333; display: inline-block; diff --git a/app/assets/stylesheets/list.css b/app/assets/stylesheets/list.css index b77482915..4d7c11b1f 100644 --- a/app/assets/stylesheets/list.css +++ b/app/assets/stylesheets/list.css @@ -70,9 +70,8 @@ } .main-list .label-td:hover { height: auto; - text-align: center; padding: 5px 5px 8px; - left: -6px; + left: -40px; top: -6px; border: 1px solid rgba(0, 0, 0, 0.2); box-shadow: 0px 5px 10px rgba(0,0,0,0.2); @@ -82,6 +81,7 @@ -webkit-border-radius: 3px; -moz-border-radius: 3px; z-index: 5; + width: 200px; } .qe-edit-div .table-condensed { background-color: #F2F2F2; @@ -188,10 +188,16 @@ legend { } .form-fixed { position: fixed; - margin-bottom: 0; + margin: 0; + padding: 10px; bottom: 0; - z-index: 10; + z-index: 2; +} +.form-fixed .btn { + margin-top: 4px; } .paginationFixed { - margin-bottom: 25px; +} +.paginationFixed .pagination { + margin-top: 0 !important; } \ No newline at end of file diff --git a/app/assets/stylesheets/style.css.erb b/app/assets/stylesheets/style.css.erb index b1f3d582f..b4410a47f 100644 --- a/app/assets/stylesheets/style.css.erb +++ b/app/assets/stylesheets/style.css.erb @@ -10,7 +10,7 @@ } .login-logo { text-indent: -9999px; - background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 40px; + background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 80px; padding-top: 40px; height: 160px; } @@ -61,8 +61,8 @@ margin-right: -20px; } #orbit-bar .search-query { - padding: 4px 9px; - height: 12px; + padding: 7px 9px 5px; + height: 10px; margin-top: 3px; border: 1px solid #333333; font-size: 11px; @@ -119,7 +119,8 @@ background-position: -10px -10px; } #orbit-bar .nav > li > a.orbit-bar-desktop { - background-position: -106px -9px; + background-position: -73px -42px; + width: 48px; } #orbit-bar .nav > li > a.orbit-bar-member { background-position: -4px -37px; @@ -635,6 +636,22 @@ .adbanner-action { margin-bottom: 20px; } +.textarea-height-s { + resize: none; + max-height: 150px; +} +.textarea-height-m { + resize: none; + max-height: 250px; +} +.textarea-height-l { + resize: none; + max-height: 350px; +} +.textarea-height-xl { + resize: none; + max-height: 500px; +} [class^="icons-"] { display: inline-block; width: 16px; diff --git a/app/controllers/admin/ad_banners_controller.rb b/app/controllers/admin/ad_banners_controller.rb index a21693aa6..47d3d3555 100644 --- a/app/controllers/admin/ad_banners_controller.rb +++ b/app/controllers/admin/ad_banners_controller.rb @@ -1,7 +1,7 @@ -class Admin::AdBannersController < ApplicationController +class Admin::AdBannersController < OrbitBackendController layout "new_admin" before_filter :authenticate_user! - before_filter :is_admin? + before_filter :for_app_manager def destroy @ad_banner = AdBanner.find(params[:id]) diff --git a/app/controllers/admin/dashboards_controller.rb b/app/controllers/admin/dashboards_controller.rb index 7b7613611..b7f377d3b 100644 --- a/app/controllers/admin/dashboards_controller.rb +++ b/app/controllers/admin/dashboards_controller.rb @@ -2,7 +2,7 @@ class Admin::DashboardsController < ApplicationController layout "new_admin" before_filter :authenticate_user! - before_filter :is_admin? +# before_filter :is_admin? def index end diff --git a/app/controllers/admin/designs_controller.rb b/app/controllers/admin/designs_controller.rb index 519b36a59..84f2b770a 100644 --- a/app/controllers/admin/designs_controller.rb +++ b/app/controllers/admin/designs_controller.rb @@ -1,11 +1,12 @@ -class Admin::DesignsController < ApplicationController +class Admin::DesignsController < OrbitBackendController require "net/http" require "uri" require 'zip/zip' layout "new_admin" before_filter :authenticate_user! - before_filter :is_admin? + before_filter :is_admin? + before_filter :for_admin_only def upload_package if !params[:design].nil? @@ -24,7 +25,7 @@ class Admin::DesignsController < ApplicationController end def index - @designs = Design.all.entries + @designs = params[:sort] ? get_sorted_and_filtered("designs") : Design.all end def new @@ -83,6 +84,13 @@ class Admin::DesignsController < ApplicationController render :action => 'new' end end + + def delete + if params[:to_delete] + designs = Design.any_in(:_id => params[:to_delete]).delete_all + end + redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) + end protected diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb index 9475e7084..1a19aebd9 100644 --- a/app/controllers/admin/sites_controller.rb +++ b/app/controllers/admin/sites_controller.rb @@ -1,16 +1,48 @@ class Admin::SitesController < ApplicationController - layout "admin" + layout "new_admin" before_filter :authenticate_user! before_filter :is_admin? + before_filter :get_site - def index - @site = Site.first - redirect_to :action => :new unless @site + # def index + # @site = Site.first + # # redirect_to :action => :new unless @site + # end + + # def new + # @site = Site.new + # end + + def update + @site.update_attributes(params[:site]) + redirect_to :back end - - def new - @site = Site.new + + def site_info + + end + + def system_info + + end + + def language + + end + + def mail_setting + + end + + def ui_theme + + end + + private + + def get_site + @site ||= Site.first end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index fb82774ef..494b497ea 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -39,15 +39,65 @@ class ApplicationController < ActionController::Base @parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil end + def auth_failed_in_backend + #redirect_to admin_dashboards_url + redirect_to root_path + end + # Check if the current_user is admin def is_admin? - redirect_to root_url unless current_user.admin? + current_user.admin? ? true : auth_failed_in_backend + end + + def is_manager? + @module_app.managing_users.include?(current_user) || is_admin? + end + + def for_admin_only + if is_admin? + true + else + flash[:error] = t("admin.access.denied.not_admin") + auth_failed_in_backend + end + end + + def for_app_manager + if is_manager? + true + else + flash[:error] = t("admin.access.denied.app.not_manager") + auth_failed_in_backend + end + end + + def for_app_sub_manager + if (@module_app.sub_managing_users.include?(current_user) || is_manager?) + true + else + flash[:error] = t("admin.access.denied.app.not_sub_manager") + auth_failed_in_backend + end + end + + def for_app_user + if (@module_app.app_auth.auth_users.include?(current_user) || for_app_sub_manager ) + true + else + flash[:error] = t("admin.access.denied.app.not_authed_user") + auth_failed_in_backend + end + end + + def check_object_premission(obj,title) + flash[:error] = t("admin.access.denied.object") + auth_failed_in_backend unless (obj.get_object_auth_by_title(title).auth_users.include?(current_user) || is_manager? || is_admin? ) end # Render the page - def render_page(id = nil) + def render_page(param={}) if @item - render :text => process_page(@item, id), :layout => 'page_layout' + render :text => process_page(@item, param[:id], param), :layout => 'page_layout' else render :text => '404 Not Found' end @@ -78,8 +128,8 @@ class ApplicationController < ActionController::Base # set site if exist or create site @site = Site.first || Site.create({:valid_locales => [], :in_use_locales => []}) session[:site] = @site.id - @site_in_use_locales = @site.in_use_locales - @site_valid_locales = @site.valid_locales + @site_in_use_locales = site_locales_default_head(@site.in_use_locales) + @site_valid_locales = site_locales_default_head(@site.valid_locales) end def set_current_item @@ -114,4 +164,14 @@ class ApplicationController < ActionController::Base end end + def site_locales_default_head(locales) + if locales[0].eql? I18n.locale.to_s + locales + else + a = Array.new(locales) + shift_out = a.delete(I18n.locale.to_s) + [shift_out] + a + end + end + end diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index 7e9fa32a8..a03a1f6c0 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -27,9 +27,13 @@ class OrbitBackendController< ApplicationController end end - def get_sorted_and_filtered(object_class) + def get_sorted_and_filtered(object_class, query=nil) object_class = object_class.classify.constantize - objects = object_class.all + if query + objects = object_class.all.where(query) + else + objects = object_class.all + end if !params[:sort].blank? options = params[:sort_options] @@ -62,30 +66,23 @@ class OrbitBackendController< ApplicationController case key when 'status' a = Array.new - objects.each do |bulletin| + objects.each do |object| value.each do |v| - case v - when 'pending' - a << bulletin if bulletin.is_checked.nil? - when 'rejected' - a << bulletin if bulletin.is_checked.eql?(false) - else - a << bulletin if bulletin[v] - end + a << object if object[v] end end objects = a.uniq when 'categories' a = Array.new - objects.each do |bulletin| - a << bulletin if value.include?(bulletin.bulletin_category.id.to_s) + objects.each do |object| + a << object if value.include?(object.send("#{object.class.to_s.underscore}_category").id.to_s) end objects = a.uniq when 'tags' a = Array.new - objects.each do |bulletin| - bulletin.tags.each do |tag| - a << bulletin if value.include?(tag.id.to_s) + objects.each do |object| + object.tags.each do |tag| + a << object if value.include?(tag.id.to_s) end end objects = a.uniq @@ -150,7 +147,7 @@ class OrbitBackendController< ApplicationController def get_with_nil(objects, option, sorted_objects) tmp = Array.new - objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).count == 0) } + objects.each { |object| tmp << [get_string_value_from_object(object), object] if (object.send(option).blank? || (object.send(option).size == 0 rescue nil)) } sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse! sorted_tmp = sorted.collect {|a| a[1] } a = params[:direction].eql?('asc') ? (sorted_tmp + sorted_objects) : (sorted_objects + sorted_tmp) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 8e9f8bb6a..c4e00aa25 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -16,10 +16,10 @@ class PagesController < ApplicationController def show #begin @item = Item.first(:conditions => {:full_name => params[:page_name]}) - if @item && @item.is_published + 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[:id]) + render_page(params) when 'Link' redirect_to "http://#{@item[:url]}" end @@ -40,7 +40,9 @@ class PagesController < ApplicationController end def show_from_link - redirect_to "/#{@item.full_name}?id=#{params[:id]}" + # debugger + # a=1 + redirect_to "/#{@item.full_name}?id=#{params[:id]}&preview=#{params[:preview]}" end def load_orbit_bar diff --git a/app/helpers/admin/ad_images_helper.rb b/app/helpers/admin/ad_images_helper.rb index 1f2422fc0..b09bd2633 100644 --- a/app/helpers/admin/ad_images_helper.rb +++ b/app/helpers/admin/ad_images_helper.rb @@ -1,7 +1,3 @@ module Admin::AdImagesHelper - def active_when_default_locale_eq locale - locale.to_sym == I18n.default_locale ? 'active': '' - end - end diff --git a/app/helpers/admin/item_helper.rb b/app/helpers/admin/item_helper.rb index d1025c559..8af4db341 100644 --- a/app/helpers/admin/item_helper.rb +++ b/app/helpers/admin/item_helper.rb @@ -28,12 +28,15 @@ module Admin::ItemHelper end def render_children(parent) - if children = parent.children + children = parent.ordered_children + if !children.entries.blank? ret = '' children.each do |child| ret << render_node_and_children(child) end ret + else + '' end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 682799eb7..e72b2b82f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,12 +2,6 @@ module ApplicationHelper FLASH_NOTICE_KEYS = [:error, :notice, :warning] - def site_valid_locales_default_head - index = @site_valid_locales.rindex I18n.default_locale.to_s - shift_out = @site_valid_locales.shift(index) - @site_valid_locales += shift_out - end - def colorize_in_use_locale(locale) @site_in_use_locales.include?(locale)? 'green' : 'red' end @@ -74,6 +68,15 @@ module ApplicationHelper end end + def active_sys_call_for_app(controller_name,action_name,app_title) + unless active_for_action(controller_name,action_name).nil? + app = ModuleApp.find params[:id] + app.title == app_title ? 'active' : nil + else + nil + end + end + def active_for_controllers(*controller_names) (controller_names.include?(controller.controller_name) || controller_names.include?(request.fullpath)) ? 'active' : nil end @@ -87,21 +90,38 @@ module ApplicationHelper ((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) - parse_page_noko(page, id) + def process_page(page, id, params) + parse_page_noko(page, id, params) end def page_metas(page) + tmp_meta = {} metas = '' - @site.page_metas.each do |meta| + @site.site_metas.each do |meta| name, content = meta.get_name_content - metas << "\n" + tmp_meta.merge!(name => content) end rescue nil - return metas + page.page_metas.each do |meta| + name, content = meta.get_name_content + tmp_meta.merge!(name => content) + end rescue nil + tmp_meta.each_pair{|name, content| + metas << "\n" + } if !tmp_meta.blank? + metas end def page_title(page) - "#{page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale]}\n" + res = "" + page_title = page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale] + if page.is_home? && @site.title + res << @site.title[I18n.locale] + elsif @site.title && @site.title_always_on + res << @site.title[I18n.locale] + ' - ' + page_title + else + res << page_title + end + res << "\n" end def page_stylesheets(page, edit=nil) @@ -112,6 +132,7 @@ module ApplicationHelper stylesheets << "\n" end stylesheets << "\n" if page.design.reset_css + # stylesheets << "\n" stylesheets << "\n" if page.design.default_css theme = page.design.themes.detect{ |d| d.id == page.theme_id } stylesheets << "\n" if theme @@ -126,8 +147,8 @@ module ApplicationHelper javascripts << "\n" javascripts << "\n" javascripts << "\n" - javascripts << "\n" javascripts << "\n" + javascripts << "\n" end javascripts << "\n" javascripts << "\n" @@ -138,4 +159,8 @@ module ApplicationHelper javascripts end + def active_when_current_locale_eq(locale) + locale.to_sym == I18n.locale ? 'active in': '' + end + end diff --git a/app/helpers/orbit_backend_helper.rb b/app/helpers/orbit_backend_helper.rb index b0da6df6e..5d47e414a 100644 --- a/app/helpers/orbit_backend_helper.rb +++ b/app/helpers/orbit_backend_helper.rb @@ -25,9 +25,9 @@ module OrbitBackendHelper content_tag :thead do content_tag :tr, :class => "sort-header" do concat (content_tag :th, :class => "span1 strong" do - concat check_box_tag :check_all - concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove" - end) if delete_all + concat check_box_tag :check_all + concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove" + end) if (delete_all && (is_admin? || (is_manager? rescue nil))) titles.each do |title| concat render_title(title[0], title[1], title[2], title[3]) end diff --git a/app/models/design/design.rb b/app/models/design/design.rb index 2a25dd110..58f95bd48 100644 --- a/app/models/design/design.rb +++ b/app/models/design/design.rb @@ -3,10 +3,10 @@ class Design include Mongoid::Timestamps include ParserLayout - field :title - field :author - field :intro - field :version + field :title, :type => String + field :author, :type => String + field :intro, :type => String + field :version, :type => String has_many :pages diff --git a/app/models/item.rb b/app/models/item.rb index 44c6762d6..c8b7812c6 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -7,6 +7,8 @@ class Item field :full_name, :index => true field :position, :type => Integer field :is_published, :type => Boolean, :default => false, :index => true + field :enabled_for, :type => Array, :default => nil + field :menu_enabled_for, :type => Array, :default => nil validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/ validates :name, :exclusion => { :in => LIST[:forbidden_item_names] } @@ -35,6 +37,21 @@ class Item urls = ancestors.map{ |a| a.name } << self.name urls.join("/") end + + def ordered_children + self.children.asc(:position) + end + + def ordered_and_visible_children + objects = ordered_children + a = [] + if objects + objects.each do |object| + a << object if object.menu_enabled_for.nil? ? true : object.menu_enabled_for.include?(I18n.locale.to_s) + end + end + a + end protected diff --git a/app/models/meta.rb b/app/models/meta.rb deleted file mode 100644 index dbeac167f..000000000 --- a/app/models/meta.rb +++ /dev/null @@ -1,15 +0,0 @@ -class Meta - - include Mongoid::Document - include Mongoid::Timestamps - - field :key - field :value, :default => nil - - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy - - def get_name_content - [self.key, self.value ? self.value : self.i18n_variable[I18n.locale]] - end - -end diff --git a/app/models/meta/meta.rb b/app/models/meta/meta.rb index 411a4f0c5..cd713d83f 100644 --- a/app/models/meta/meta.rb +++ b/app/models/meta/meta.rb @@ -7,5 +7,13 @@ class Meta field :value, :default => nil has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + + def get_name_content + [self.key, get_content] + end + + def get_content + self.value ? self.value : self.i18n_variable[I18n.locale] + end end diff --git a/app/models/site.rb b/app/models/site.rb index 8f367c0a2..a3e0513d3 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -1,5 +1,7 @@ class Site + METAS = ['description', 'keywords'] + include Mongoid::Document include Mongoid::Timestamps @@ -9,12 +11,17 @@ class Site field :roaming_id field :private_key, :type => Binary field :public_key, :type => Binary + field :title_always_on, :type => Boolean, :default => false field :school field :department + has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_many :site_metas, :autosave => true, :dependent => :destroy + before_save :set_key + def generate_keys private_key = OpenSSL::PKey::RSA.generate(2048) self.public_key = private_key.public_key.to_s @@ -30,5 +37,35 @@ class Site res = res.split('rails_3_1').pop.gsub('(', '').gsub(')','').strip rescue nil res.eql?('local out of date') ? false : true end + + def title + @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil + end + + def footer + @footer ||= I18nVariable.first(:conditions => {:key => 'footer', :language_value_id => self.id, :language_value_type => self.class}) rescue nil + end + + METAS.each do |meta| + define_method meta do + fetch_meta = self.site_metas.where(key: meta).limit(1) + fetch_meta.blank? ? nil : fetch_meta[0].i18n_variable + end + define_method "#{meta}=" do |values| + if a = self.send(meta) + a.update_attributes(values) + else + a = self.site_metas.build(key: meta) + a.build_i18n_variable(values) + end + end + end + + protected + + def set_key + title.key = 'title' if title && (title.key.blank? rescue true) + footer.key = 'footer' if footer && (footer.key.blank? rescue true) + end end diff --git a/app/views/admin/ad_banners/_ad_banner_tab.html.erb b/app/views/admin/ad_banners/_ad_banner_tab.html.erb index ff27d914f..797624ff1 100644 --- a/app/views/admin/ad_banners/_ad_banner_tab.html.erb +++ b/app/views/admin/ad_banners/_ad_banner_tab.html.erb @@ -15,7 +15,7 @@
<%= link_to t("admin.ad.new_image"),new_admin_ad_banner_ad_image_path(ad_banner_tab) ,:class => "btn btn-primary"%> - <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.title) , :class=>'preview_trigger btn btn-success'%> + <%= link_to t("modal.preview"), admin_realtime_preview_ad_banner_path(ad_banner_tab.id) , :class=>'preview_trigger btn btn-success'%>
-
<%= yield %>
diff --git a/app/views/layouts/page_layout.html.erb b/app/views/layouts/page_layout.html.erb index 8fb884b07..dd9aa94ad 100644 --- a/app/views/layouts/page_layout.html.erb +++ b/app/views/layouts/page_layout.html.erb @@ -4,7 +4,6 @@ <%= page_title(@item).html_safe %> <%= page_metas(@item).html_safe %> - <%= @metas %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 69491cbcf..4713415f7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -68,6 +68,14 @@ en: traffic: Traffic admin: + access: + denied: + app: + not_sub_manager: Access Denied for you are not SubManager for this app + not_manager: Access Denied for you are not SubManager for this app + not_authed_user: Access Denied for you are not User for this app + not_admin: Access Denied for you are not Admin + object: "Access Denied for you don't have permission for this object" action: Action ad_banner: AD Banner ad: @@ -90,6 +98,7 @@ en: admin: Admin action: Action all_articles: List + always_display_title: Always displayed in the title bar announcement: Announcement asset: Asset assets: @@ -128,6 +137,7 @@ en: editing_role: Editing user role email: Email enable_language: Enable language + enabled_for: Enabled for file_name: Filename file_size: File size format: Format @@ -138,6 +148,7 @@ en: is_published: Is published item: Item key: Key + keywords: Keywords language: Language layout: Layout layout_name: Layout name @@ -152,6 +163,7 @@ en: list_infos: User information list list_roles: User roles list member: Member + menu_enabled_for: Menu enabled for module: authorization: Module Authorization move_down: Move down @@ -190,7 +202,10 @@ en: setup_translations: Translations setup setup_designs: Designs setup site: Site + site_description: Site description + site_footer: Site footer site_settings: Site Setting + site_title: Site title super_pages: Super pages structure: Structure title: Title diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 6e6800949..dc9e0cb8f 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -8,12 +8,12 @@ zh_tw: back: 回上一步 browse: 選擇檔案 cancel: 取消 - create: 創建 + create: 新增 delete: 刪除 desktop: 桌面 disable: 禁用 dots: … - downloaded: 已經下載 + downloaded: 已下載 download: 下載 edit: 編輯 email: 電子郵件 @@ -50,7 +50,7 @@ zh_tw: file_type: 檔案類型 hits: 點擊率 item: 項目 - member: 成員 + member: 會員 module: 模組 most_visited_page: 熱門頁面 quantity: 數量 @@ -65,6 +65,14 @@ zh_tw: traffic: 流量 admin: + access: + denied: + app: + not_sub_manager: 拒絕存取因你不是此應用程式次管理員 + not_manager: 拒絕存取因你不是此應用程式管理員 + not_authed_user: 拒絕存取因你不是此應用程式授權使用者 + not_admin: 拒絕存取因你不是此應用程式次管理員 + object: 拒絕存取因你不是網站管理者 action: 操作 ad_banner: 廣告輪播 ad: @@ -84,8 +92,9 @@ zh_tw: add_item: 新增項目 add_language: 新增語言 add_drop_down_item: +增加Orbit選單 - admin: 管理 + admin: 網站管理者 all_articles: 列表 + always_display_title: 永遠顯示於標題列 announcement: 公告管理 asset: 資產 assets: @@ -97,22 +106,22 @@ zh_tw: author: 作者 calendar: 行事曆 cant_delete_self: 您不可以刪除自己。 - cant_revoke_self_admin: 您不可以撤銷自己的管理作用。 + cant_revoke_self_admin: 您不可以撤銷自己的管理身份。 choose_file: 請選擇一個文件... class: 階級 content: 內容 - create_error_link: 創建連接時出錯。 - create_error_page: 創建頁面時出錯。 - create_success_home: 首頁已成功創建。 - create_success_layout: 樣板已成功創建。 - create_success_link: 連結已成功創建。 - create_success_page: 頁面已成功創建。 - create_success_home: 首頁已成功創建。 - create_success_layout: 佈局已成功創建。 - create_success_link: 連結已成功創建。 - create_success_page: 頁面已成功創建。 - create_success_snippet: 片段已成功創建。 - create_success_user: 用戶已成功創建。。 + create_error_link: 新增連接時出錯。 + create_error_page: 新增頁面時出錯。 + create_success_home: 首頁已成功新增。 + create_success_layout: 樣板已成功新增。 + create_success_link: 連結已成功新增。 + create_success_page: 頁面已成功新增。 + create_success_home: 首頁已成功新增。 + create_success_layout: 佈局已成功新增。 + create_success_link: 連結已成功新增。 + create_success_page: 頁面已成功新增。 + create_success_snippet: 片段已成功新增。 + create_success_user: 用戶已成功新增。。 dashboard: 儀表板 data: 資料數據 delete_language: 刪除語言 @@ -129,6 +138,7 @@ zh_tw: editing_role: 編輯用戶身份 email: Email enable_language: 啟用語言 + enabled_for: 啟用 file_name: 檔名 file_size: 檔案大小 format: 格式 @@ -138,7 +148,8 @@ zh_tw: intro: 簡介 is_published: 被出版 item: 網站架構 - key: 鍵值 + key: 關鍵 + keywords: 關鍵字 language: 語言 layout: 佈局 layout_name: 佈局名字 @@ -153,6 +164,7 @@ zh_tw: list_infos: 用戶資料列表 list_roles: 用戶身份列表 member: 會員 + menu_enabled_for: 選單啟用 module: authorization: 模組授權 move_down: 往下移 @@ -186,7 +198,10 @@ zh_tw: purchase: 購買 role: 身份 roles: 身份 + site_description: 網站描述 + site_footer: 網站頁尾 site_settings: 基本設定 + site_title: 網站標題 setup_member: 成員設置 setup_translations: 語系設定 setup_designs: 版型設定 diff --git a/config/routes.rb b/config/routes.rb index f560d8191..f486581b8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,7 +25,7 @@ Orbit::Application.routes.draw do end - match 'ad_banner/:id/preview' => 'ad_banners#realtime_preview',:as => :realtime_preview_ad_banner,:via => :put + match 'ad_banners/:id/preview' => 'ad_banners#realtime_preview',:as => :realtime_preview_ad_banner,:via => :put resources :ad_banners do collection do match 'new_ad_image' => 'ad_images#new',:as => :new_ad_image,:via => :get @@ -37,6 +37,7 @@ Orbit::Application.routes.draw do resources :designs do collection do get 'upload_package' + post 'delete' post 'upload_package' end member do @@ -92,7 +93,13 @@ Orbit::Application.routes.draw do get 'add_sub_role' get 'add_attribute_field' end - resources :sites + resources :sites do + get 'site_info' + get 'system_info' + get 'language' + get 'mail_setting' + get 'ui_theme' + end resources :snippets resources :tags resources :translations diff --git a/lib/parsers/parser_back_end.rb b/lib/parsers/parser_back_end.rb index 24b6c59f4..0ebaf90be 100644 --- a/lib/parsers/parser_back_end.rb +++ b/lib/parsers/parser_back_end.rb @@ -28,6 +28,7 @@ module ParserBackEnd parse_menu(body, page, true) public_r_tags = parse_content_edits(body, page, id) parse_images(body, page) + parse_footer(body, page, true) public_r_tags.each do |tag| send("parse_#{tag}s", body, page,id) diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index 6e7fea47f..41d57cbb6 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -1,47 +1,36 @@ module ParserCommon - + include ActionView::Helpers::TagHelper + def menu_level(page, current, menu, edit = false) res = '' - if menu.levels > 0 && current <= menu.levels - if current != 0 - res << "
" - item = rand(100000) - res << "#{page.i18n_variable[I18n.locale]}" - if page.children.size > 0 - res << "
" - res << "" - res << "
" - end - res << "
" - else - res << '' + if page.ordered_and_visible_children.size > 0 + res << "" end res end def menu_li(page, current, menu, i, edit) res = "" end @@ -103,7 +92,7 @@ module ParserCommon page_menu = body.css('.page_menu').first home = get_homepage menu = page.design.layout.menu - fragment = Nokogiri::HTML::DocumentFragment.new(body, menu_level(home, 0, menu, edit)) + fragment = Nokogiri::HTML::DocumentFragment.new(body, menu_level(home, 1, menu, edit)) page_menu.swap(fragment) end @@ -114,7 +103,7 @@ module ParserCommon res << "
" res << "

#{page.i18n_variable[I18n.locale]}

" res << "
" + fragment = Nokogiri::HTML::DocumentFragment.new(body ,res) + page_footer.swap(fragment) rescue nil + end + end diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb index 5eea7f9fd..d37eba303 100644 --- a/lib/parsers/parser_front_end.rb +++ b/lib/parsers/parser_front_end.rb @@ -21,11 +21,12 @@ module ParserFrontEnd require 'nokogiri' - def parse_page_noko(page, id = nil) + def parse_page_noko(page, id = nil,params) body = Nokogiri::HTML(page.design.layout.body) parse_menu(body, page) - public_r_tags = parse_contents(body, page, id) + public_r_tags = parse_contents(body, page, id,params[:preview]) parse_images(body, page) + parse_footer(body, page, true) public_r_tags.each do |tag| send("parse_#{tag}s", body, page,id) @@ -35,7 +36,7 @@ module ParserFrontEnd end # page_contents - def parse_contents(body, page, id) + def parse_contents(body, page, id,preview = false) public_r_tags = [] body.css('.page_content').each do |content| ret = '' @@ -46,6 +47,7 @@ module ParserFrontEnd # ret << "&category_id=#{page.category}" if page[:category] ret << "&category_id=#{params[:category_id]}" if !params[:category_id].blank? ret << "&tag_id=#{params[:tag_id]}" if !params[:tag_id].blank? + ret << "&preview=true" if preview.eql?('true') ret << "'>" else part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb index 2d10dd75f..566b07426 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb @@ -1,7 +1,15 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController before_filter :authenticate_user! + before_filter :is_admin? include AdminHelper # layout 'admin' + def preview_and_approve + @bulletin = Bulletin.find params[:bulletin_id] + end + + def approve + + end def setting @bulletin_categorys = BulletinCategory.all diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb index 841dedf0f..5c23ded5f 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb @@ -1,5 +1,6 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController - layout 'new_admin' + + before_filter :for_app_manager,:except => [:index] def index @bulletin_categorys = BulletinCategory.all diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index 8677ef79e..8ed6389a8 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -3,8 +3,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController layout 'new_admin' before_filter :authenticate_user! - before_filter :is_admin? - +# before_filter :for_admin_only,:only => [:] +# before_filter :for_app_manager,:only => [:index,:show,] + before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins] def index # @bulletins = Bulletin.all # @bulletins = Bulletin.desc("postdate desc") @@ -44,6 +45,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @bulletin_file = BulletinFile.new @file_url = panel_announcement_back_end_bulletins_path + @bulletins.delete_if{ |bulletin| + bulletin.is_pending == true && (!bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || bulletin.create_user_id!=current_user.id) + } + respond_to do |format| format.html # index.html.erb format.js { } @@ -81,14 +86,17 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # @bulletin.bulletin_files.build # @bulletin.bulletin_files.new - - get_categorys - get_tags - respond_to do |format| - format.html # new.html.erb - format.xml { render :xml => @bulletin } - end + if get_categorys.empty? + flash[:alert] = t("announcement.error.no_avilb_cate_for_posting") + redirect_to :action => :index + else + get_tags + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @bulletin } + end + end end # GET /bulletins/1/edit @@ -312,10 +320,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController def get_categorys(id = nil) @bulletin_categorys = [] + @unit_list_for_anc = UnitListForAnc.all if(is_manager? || is_admin?) @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true)) elsif is_sub_manager? - @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') + @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit') end end @@ -323,87 +332,5 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController module_app = ModuleApp.first(:conditions => {:key => 'announcement'}) @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) end - - def get_sorted_and_filtered_bulletins - bulletins = Bulletin.all - case params[:sort] - when 'postdate', 'deadline' - bulletins = bulletins.order_by([params[:sort], params[:direction]]) - when 'category' - category_ids = bulletins.distinct(:bulletin_category_id) - categories = BulletinCategory.find(category_ids) rescue nil - if categories - h = Hash.new - categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id } - sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse! - sorted_categorys = sorted.collect {|a| bulletins.where(:bulletin_category_id => a[1]).entries } - bulletins = sorted_categorys.flatten! - end - when 'title' - h = Array.new - bulletins.each { |bulletin| h << [bulletin.title[I18n.locale].downcase, bulletin] } - sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse! - bulletins = sorted.collect {|a| a[1] } - when 'status' - bulletins = bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction]).order_by(:is_pending, params[:direction]).order_by(:is_checked, params[:direction]).order_by(:is_rejected, params[:direction]) - when 'update_user_id' - user_ids = bulletins.distinct(:update_user_id) - users = User.find(user_ids) rescue nil - if users - h = Array.new - users.each { |user| h << [user.name, user.id] } - sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse! - sorted_users = sorted.collect {|a| bulletins.where(:update_user_id => a[1]).entries } - bulletins = sorted_users.flatten - end - when 'tags' - a = Array.new - AnnouncementTag.all.order_by(I18n.locale, params[:direction]).each { |tag| a << tag.bulletins } - a.flatten! - a.uniq! - tmp = Array.new - bulletins.where(:tag_ids => []).each { |bulletin| tmp << [bulletin.title[I18n.locale].downcase, bulletin] } - sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse! - sorted_titles = sorted.collect {|a| a[1] } - a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles) - bulletins = a.flatten - end - if @filter - @filter.each do |key, value| - case key - when 'status' - a = Array.new - bulletins.each do |bulletin| - value.each do |v| - case v - when 'pending' - a << bulletin if bulletin.is_checked.nil? - when 'rejected' - a << bulletin if bulletin.is_checked.eql?(false) - else - a << bulletin if bulletin[v] - end - end - end - bulletins = a.uniq - when 'categories' - a = Array.new - bulletins.each do |bulletin| - a << bulletin if value.include?(bulletin.bulletin_category.id.to_s) - end - bulletins = a.uniq - when 'tags' - a = Array.new - bulletins.each do |bulletin| - bulletin.tags.each do |tag| - a << bulletin if value.include?(tag.id.to_s) - end - end - bulletins = a.uniq - end if value.size > 0 - end - end - Kaminari.paginate_array(bulletins).page(params[:page]).per(10) - end end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index e8f25163e..d3efc5c6e 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -25,10 +25,20 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController end def show - @bulletin = Bulletin.can_display.where(_id: params[:id]).first - get_categorys + if params[:preview] == "true" + preview_content + else + @bulletin = Bulletin.can_display.where(_id: params[:id]).first + get_categorys + end + end + def preview_content + @bulletin = Bulletin.find params[:id] + get_categorys + render :show + end protected diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb index 5dcf39d3a..8e6b9bff9 100644 --- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb +++ b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb @@ -2,7 +2,7 @@ module Panel::Announcement::BackEnd::BulletinsHelper def show_approval_link(bulletin) by_bulletin = (!bulletin.is_expired? and !bulletin.is_checked?) - by_user = bulletin.bulletin_category.authed_users('fact_check').include?(current_user) or is_manager? + by_user = (bulletin.bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?) by_bulletin and by_user end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 44882df36..008090f42 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -33,6 +33,7 @@ class Bulletin mount_uploader :image, ImageUploader belongs_to :bulletin_category + belongs_to :unit_list_for_anc # embeds_many :bulletin_links, :cascade_callbacks => true # embeds_many :bulletin_files, :cascade_callbacks => true diff --git a/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb b/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb new file mode 100644 index 000000000..5261f6a2a --- /dev/null +++ b/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb @@ -0,0 +1,12 @@ +class UnitListForAnc + include Mongoid::Document + include Mongoid::Timestamps + + field :order + field :ut_code + field :up_ut_code + + has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true + + +end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_modal_approve.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_modal_approve.html.erb new file mode 100644 index 000000000..35049b981 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_modal_approve.html.erb @@ -0,0 +1,69 @@ + <% if bulletin -%> + + + + + +<% end -%> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/preview_and_approve.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/preview_and_approve.js.erb new file mode 100644 index 000000000..d0e4649dd --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/preview_and_approve.js.erb @@ -0,0 +1,5 @@ +$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_approve',:locals => {:bulletin => @bulletin})) %>"); +var start_modal_with_id = "bulletin-<%=@bulletin.id%>"; +$("#"+start_modal_with_id).css("width","1050px"); +$("#"+start_modal_with_id).css("height","768px"); +$("#"+start_modal_with_id).css("margin","-270px 0 0 -550px"); \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb index a75440e56..8ad4578ea 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_bulletin_category.html.erb @@ -4,10 +4,13 @@ <%= bulletin_category.key %>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb index 4d31464f1..26a88dab7 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/index.html.erb @@ -35,7 +35,7 @@ -
<%= render :partial => "form" %>
+
<%= render :partial => "form" if is_manager?%>
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb index d171e0b3c..b69def3b5 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb @@ -1,5 +1,9 @@ - <%= check_box_tag 'to_delete[]', bulletin.id, false, :class => "checkbox_in_list" %> + + <% if (bulletin.create_user_id == current_user.id) || is_manager? %> + <%= check_box_tag 'to_delete[]', bulletin.id, false, :class => "checkbox_in_list" %> + <% end -%> +
@@ -27,27 +31,32 @@ <%= bulletin.bulletin_category.i18n_variable[I18n.locale] %> <%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%> +
diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 360cead24..59cfa5385 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -105,28 +105,6 @@
-

Audit

-
- - <% if is_manager? || @bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %> -
- <%= f.label :approval_stat, t('announcement.bulletin.approval_stat') %> - <%= content_tag :label,:class => "radio inline" do -%> - <%= f.radio_button :is_checked, true , {:class => 'privacy'} %> - <%= t('announcement.bulletin.approval_pass') %> - <% end -%> - <%= content_tag :label,:class => "radio inline" do -%> - <%= f.radio_button :is_checked, false, (!@bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%> - <%= t('announcement.bulletin.approval_not_pass') %> - <% end -%> -
- <%= label :is_checked_false, t('announcement.bulletin.approval_not_pass_reason') %> - <%= f.text_field :not_checked_reason %> -
- -
- <% end %> -
<% elsif current_user.admin? %> <%= f.hidden_field :is_checked,:value => true%> @@ -139,13 +117,16 @@
+ + <%= f.label :unit_list_for_anc%> + <%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %> <%= f.label :category %> <%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> @@ -153,7 +134,7 @@
<%# @site_valid_locales.each_with_index do |locale, i| %> - <% site_valid_locales_default_head.each_with_index do |locale, i| %> + <% @site_valid_locales.each_with_index do |locale, i| %>
"> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index 563be1906..c64035a56 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -5,8 +5,11 @@ <% end %> -
- <%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %> +
+ <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary pull-right' %> +
+ <%= paginate @bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %> +
- -
- <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_announcement_back_end_bulletin_path, :class => 'btn btn-primary' %> -
<% content_for :page_specific_javascript do %> <%= javascript_include_tag "bulletin_form" %> + <%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %> + <%= javascript_include_tag "inc/modal-preview" %> <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb index 2f37df9c1..c6d0c06d2 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/front_end/bulletins/show.html.erb @@ -4,7 +4,7 @@
@@ -14,58 +14,18 @@
<%= @bulletin.text[I18n.locale].html_safe %>
+ +<%= t('announcement.link') %> +<% @bulletin.bulletin_links.each do | blink | %> + <%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %> +<% end %> + +
  • +<%= t('announcement.file') %> +<% @bulletin.bulletin_files.each do | bfile | %> +<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %> +<% end %> +
    - - -<%#= link_back %> diff --git a/vendor/built_in_modules/announcement/config/locales/en.yml b/vendor/built_in_modules/announcement/config/locales/en.yml index 5f3193406..1c4f51b0a 100644 --- a/vendor/built_in_modules/announcement/config/locales/en.yml +++ b/vendor/built_in_modules/announcement/config/locales/en.yml @@ -59,6 +59,8 @@ en: all_articles: List add_new: Add categories: Categories + error: + no_avilb_cate_for_posting: You need a category to submit your post,please contact admin sure?: Sure? campus_news: Campus News more: more+ @@ -80,8 +82,9 @@ en: approval_setting_window_title: 'Unit' approval_user_list: 'Approval Users' cate_auth: Category Authorization + submit_approval: Submit approval tag_cloud: Tag cloud - + # admin: # action: Action # add_language: Add language diff --git a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml index 11e79fcca..5cadd8433 100644 --- a/vendor/built_in_modules/announcement/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/announcement/config/locales/zh_tw.yml @@ -37,6 +37,8 @@ zh_tw: announcement: add_new: 新增 all_articles: 列表 + error: + no_avilb_cate_for_posting: 您目前沒有分類可以刊登公告,請聯絡系統管理員為您開通分類 tags: 標籤 categories: 分類 status: 狀態 @@ -61,6 +63,7 @@ zh_tw: approval_setting_window_title: '單位' approval_user_list: '審核者' cate_auth: '分類授權' + submit_approval: '提交審核' tag_cloud: 標籤雲 bulletin: diff --git a/vendor/built_in_modules/announcement/config/routes.rb b/vendor/built_in_modules/announcement/config/routes.rb index 6e60960fc..396ea8e47 100644 --- a/vendor/built_in_modules/announcement/config/routes.rb +++ b/vendor/built_in_modules/announcement/config/routes.rb @@ -7,6 +7,8 @@ Rails.application.routes.draw do match 'approval_setting' => "approvals#update_setting" ,:as => :approval_setting,:via => :post match 'approval_setting' => "approvals#user_list" ,:as => :approval_user_list,:via => :put resources :bulletins do + match "approve/:bulletin_id" => "approvals#preview_and_approve",:as => :approval_preview,:via => :put + match "approve/:bulletin_id" => "approvals#approve",:as => :approve,:via => :post match "link_quick_add/:bulletin_id" => "bulletins#link_quick_add" ,:as => :link_quick_add match "link_quick_edit/:bulletin_id" => "bulletins#link_quick_edit" ,:as => :link_quick_edit member do @@ -32,7 +34,9 @@ Rails.application.routes.draw do resources :tags end namespace :front_end do - resources :bulletins + resources :bulletins # do + # match "preview" => "bulletins#preview_content",:as => :get_preview_content + # end end namespace :widget do match "bulletins" => "bulletins#index" diff --git a/vendor/built_in_modules/announcement/lib/tasks/data_for_ut_list_for_posting_anc.rake b/vendor/built_in_modules/announcement/lib/tasks/data_for_ut_list_for_posting_anc.rake new file mode 100644 index 000000000..e5bd0be22 --- /dev/null +++ b/vendor/built_in_modules/announcement/lib/tasks/data_for_ut_list_for_posting_anc.rake @@ -0,0 +1,15 @@ +# encoding: utf-8 + +namespace :nccu_data do + desc "load nccu data from csv" + task :setup_ut_list => :environment do + require 'csv' + + CSV.foreach("vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv") do |row| + new_unit = UnitListForAnc.new(:order => row[0], :ut_code => row[1], :up_ut_code => row[2], :created_at => Time.now,:updated_at => Time.now) + new_unit.build_title :en => row[4], :zh_tw => row[3] + new_unit.save + end + + end +end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv b/vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv new file mode 100644 index 000000000..548ad5281 --- /dev/null +++ b/vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv @@ -0,0 +1,186 @@ +order,ut_code,up_tu_code,ut_zh_tw,ut_en +0100,H00,H00,校長室,Office of the President +0110,H01,H01,副校長室一,Office of the Vice President +0110,H03,H03,副校長室二,Office of the Vice President +0200,100,100,文學院,College of Liberal Arts +0210,101,100,中文系,Dept. of Chinese Literature +0220,103,100,歷史系,Dept. of History +0230,104,100,哲學系,Dept. of Philosophy +0240,155,100,圖檔所,"Graduate Institute of Library, Informati" +0250,156,100,宗教所,Graduate Institute of Religious Studies +0260,158,100,台史所,Graduate Institute of Taiwan History +0270,159,100,台文所,Graduate Institute of Taiwan Literatu +0280,161,100,華文碩,Master's Program in Teaching Chinese as +0290,160,100,華文博,Doctor's Program in Teaching Chinese as +0294,913,100,圖資專班,E-learning Master Program of Library and +0300,700,700,理學院,College of Science +0310,701,700,應數系,Dept. of Mathematical Sciences +0320,702,700,心理系,Dept. of Psychology +0330,703,700,資科系,Dept. of Computer Science +0340,754,700,神科所,The Graduate Institute of Neuroscience +0350,755,700,應物所,Graduate Institute of Applied Physics +0600,200,200,社科院,College of Social Sciences +0605,202,200,政治系,Dept. of Political Science +0610,204,200,社會系,Dept. of Sociology +0615,205,200,財政系,Dept. of Public Finance +0620,206,200,公行系,Dept. of Public Administration +0625,207,200,地政系,Dept. of Land Economics +0630,208,200,經濟系,Dept. of Economics +0635,209,200,民族系,Dept. of Ethnology +0640,261,200,國發所,GIDS +0645,262,200,勞工所,Graduate Institute of Labor Research +0650,264,200,社工所,Graduate Institute of Social Work +0652,265,200,亞太博,International Doctor Program in Asia-Pac +0700,600,600,法學院,College of Law +0710,601,600,法律系,Dept. of Law +0720,652,600,法科所,The Institute of Law and Inter-disciplin +0800,300,300,商學院,College of Commerce +0801,301,300,國貿系,Dept. of International Business +0803,302,300,金融系,Dept. of Money and Banking +0805,303,300,會計系,Dept. of Accounting +0807,304,300,統計系,Dept. of Statistics +0809,305,300,企管系,Dept. of Business Administration +0811,306,300,資管系,Dept. of Management Information System +0813,307,300,財管系,Dept. of Finance +0815,308,300,風管系,Dept. of Risk Management and Insurance +0817,359,300,科管所,Graduate Institute of Technology and Inn +0819,361,300,智財所,Graduate Institute of Intellectual Prope +0821,362,300,管理碩士學程,Advanced Master of Business Administrati +0823,380,300,商管碩,Advanced Master of Business Administrati +1100,500,500,外語學院,College of Foreign Languages +1110,501,500,英文系,Dept. of English +1120,502,500,阿文系,Dept. of Arabic Language and Literature +1130,504,500,斯拉夫文系,Dept. of Slavic Languages and Literature +1140,506,500,日文系,Dept. of Japanese +1150,507,500,韓文系,Dept. of Korean Language and Cultur +1160,508,500,土文系,Dept. of Turkish Language and Cultu +1170,555,500,語言所,Graduate Institute of Linguistics +1180,509,500,歐洲語文學程,Undergraduate Program in European Langua +1190,5T1,500,外文中心,Foreign Languages Center +1200,400,400,傳播學院,College of Communication +1210,401,400,新聞系,Dept. of Journalism +1220,402,400,廣告系,Dept. of Advertising +1230,403,400,廣電系,Dept. of Radio and Television +1240,461,400,國傳英語碩士學位學程,International Master's Program in Intern +1250,404,400,傳播學程,College of Communication Undergraduate D +1260,462,400,數位內容學程,DCT +1270,781,700,數位內容與科技學士學位學程,數位內容與科技學士學位學程 +1280,4A1,400,實習廣播電台,NCCU Community Radio Station +1300,800,800,國際事務學院,College of International Affairs +1310,203,800,外交系,Dept. of Diplomacy +1320,260,800,東亞所,Graduate Institute of East Asian Studies +1330,263,800,俄研所,Graduate Institute of Russian Studies +1340,861,800,日碩研,Master Program in Japan Studies +1346,862,800,國際研究英語碩士學位學程(籌備處),International Master's Program in Intern +1600,900,900,教育學院,College of Education +1610,102,900,教育系,Dept. of Education +1620,157,900,幼教所,Graduate Institute of Early Childhood Ed +1630,171,900,教政所,Graduate Institute of Educational Admini +1640,1T3,900,師培中心,Institute of Teacher Education +1652,172,900,輔諮碩學程,MPCG +1660,1T1,900,教研中心,The Teacher In-Service Education Center +1700,L00,L00,國關中心,The Institute of International Relations +1710,L01,L00,國關第一所,First Division +1720,L02,L00,國關第二所,Second Division +1730,L03,L00,國關第三所,Third Division +1740,L04,L00,國關第四所,Fourth Division +1750,L05,L00,國關合交組,The Institute of International Relations +1760,L06,L00,國關編譯組,The Institute of International Relations +1770,L07,L00,國關圖資組,The Institute of International Relations +1780,L08,L00,國關秘書組,The Institute of International Relations +1800,S00,S00,選研中心,Election Study Center +1900,Z01,Z01,第三部門研究中心,Center for the Third Sector +1910,Z02,Z02,創新創造力研究中心,CCIS +1920,Z03,Z03,中國大陸研究中心,Center for China Studies +1930,Z04,Z04,台灣研究中心,TSC +1940,Z08,Z08,心腦學中心,"Reseach Center for Mind, Brain and Learn" +1950,Z10,Z10,原民中心,Center for Aboriginal Studies +1960,Z09,Z09,人文中心,Humanities Center +2000,T00,T00,教務處,Office of Academic Affairs +2010,T01,T00,教務處註冊組,Registration Section +2020,T02,T00,教務處課務組,Instruction Resources Section +2030,T03,T00,教務處綜合業務組,Admission Section +2040,T04,T00,教務處通識教育中心,Center of General Education +2100,M00,M00,學務處,Office of Student Affairs +2110,M01,M00,學務處生僑組,Life Guidance and Overseas Chinese Stude +2120,M02,M00,學務處課外組,Student Activities Section +2130,M03,M00,學務處住宿組,Student Housing Service Section +2150,M11,M00,學務處藝文中心,Art and Culture Center +2155,M14,M00,學務處身心健康中心,Physical and Mental Health Center +2160,M13,M00,學務處職涯中心,Center of Career Development +2170,D00,M00,學務處軍訓室,Military Education Office +2200,G00,G00,總務處,Office of General Affairs +2210,G01,G00,總務處文書組,Document and postal section +2220,G02,G00,總務處事務組,General Management Section +2230,G05,G00,總務處出納組,Cashier Section +2240,G04,G00,總務處營繕組,Construction and Maintenance Section +2250,G03,G00,總務處財產組,Property Management SEction +2260,G06,G00,總務處環保組,Environmental Protection Section +2270,G08,G00,總務處規劃組,Campus Planning & Devel opment Section +2280,G07,G00,總務處駐警隊,Campus Security National Chengchi Unive +2300,R00,R00,研發處,Office of Research and Development +2310,R01,R00,研發處企畫組,Planning Section +2320,R02,R00,研發處學術推展組,Academic Development Section +2330,R03,R00,研發處學評組,Academic Evaluation Section +2400,Z05,Z05,國合處,Office of International Cooperation +2410,Z06,Z05,國合處合作交流組,CES +2420,Z07,Z05,國合處教育組,IES +2430,Z14,Z05,國合處發展策劃組,DPS +2500,Q00,Q00,秘書處,Secretariat +2510,Q01,Q00,秘書處第一組,First Section +2520,Q02,Q00,秘書處第二組,Second Section +2530,Q03,Q00,秘書處第三組,Third Section +2600,K00,K00,圖書館,Libraries +2610,K06,K00,圖書館資訊組,System Information Section +2620,K07,K00,圖書館採編組,Acquisition & Cataloging Section +2630,K08,K00,圖書館典閱組,Circulation Section +2640,K09,K00,圖書館推廣服務組,Reference Services Section +2650,K10,K00,圖書館數位典藏組,Digital Preservation Section +2660,K11,K00,圖書館行政組,Administration Section +2670,K12,K00,圖書館圖書分館,Branch Libraries +2700,B00,B00,體育室,Physical Education Office +2710,B01,B00,體育教學組,Physical Education Office +2720,B02,B00,體育活動組,Sport activities section +2800,P00,P00,人事室,Personnel Office +2810,P01,P00,人一組,First Section +2820,P02,P00,人二組,Second Section +2830,P03,P00,人三組,Third Section +2840,P04,P00,人四組,Fourth Section +2900,A00,A00,會計室,Accounting Office +2910,A01,A00,會計室第一組,Budgeting Section +2920,A02,A00,會計室第二組,Accounting Section +2930,A03,A00,會計室第三組,Auditing Section +3000,I00,I00,公企中心,Public and Business Administration Educa +3010,I01,I00,公企諮詢組,Research and Consultation Section +3020,I02,I00,公企職訓組,Training Section +3030,I03,I00,公企語訓組,Language Training Section +3040,I04,I00,公企總務組,General Affairs Section +3050,I05,I00,公企中心圖資組,Library Resource Section +3100,O00,O00,公教中心,Civil Service Education Center +3110,O01,O00,公教教務組,Civil Service Education Center +3120,O02,O00,公教輔導組,Civil Service Education Center +3130,O03,O00,公教行政組,Civil Service Education Center +3200,J00,J00,社資中心,Social Sciences Information Center +3210,J03,J00,社資資料組,Reference Services Section +3220,J04,J00,社資研發組,Section of Research & Development +3300,C00,C00,電算中心,Computer Center +3310,C01,C00,電算教研組,Teaching and Research Section +3320,C02,C00,電算系統組,Application System Section +3330,C03,C00,電算行政組,Administration and Counseling Section +3340,C04,C00,電算網路組,Networking and Development Section +3400,T05,T05,教學發展中心,Center for Teaching and Learning Develop +3410,T06,T05,教發教學組,Teaching and Learning Division +3420,T07,T05,教發數位組,E-Learning Division +3430,T08,T05,教發規劃組,Planning and Research Division +3500,162,162,華語文中心,Chinese Language Center +3600,Z11,Z11,育成中心,Innovation Incubation Center +3700,V00,V00,附設實小,The Experimental Elementary School +3700,V01,V00,附設實小教務處,Office of Academic Affairs +3700,V02,V00,附設實小學務處,Office of Student Affairs +3700,V03,V00,附設實小輔導室,The Experimental Elementary School +3700,V04,V00,附設實小總務處,Office of General Affairs +3700,V06,V00,附設實小研究處,The Experimental Elementary School +3710,V05,V00,附設實小幼稚園,The Experimental Elementary School +3800,W00,W00,附中,The Affiliated High School +3900,Z13,Z13,政大書院辦公室,Chengchi College Project Office +4000,Z12,Z12,頂大辦公室,Office of NCCU Top University Program \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb index c6cb33ea3..c6eda9d04 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_approvals_controller.rb @@ -1,7 +1,16 @@ class Panel::News::BackEnd::NewsApprovalsController < OrbitBackendController before_filter :authenticate_user! + before_filter :is_admin? include AdminHelper + def preview_and_approve + @bulletin = NewsBulletin.find params[:bulletin_id] + end + + def approve + + end + def setting @news_bulletin_categorys = NewsBulletinCategory.all if params.has_key?(:category_id) diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_categorys_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_categorys_controller.rb index 83ca09f83..956e98dca 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_categorys_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletin_categorys_controller.rb @@ -1,5 +1,8 @@ class Panel::News::BackEnd::NewsBulletinCategorysController < OrbitBackendController + before_filter :for_app_manager,:except => [:index] + + def index @news_bulletin_categorys = NewsBulletinCategory.all @news_bulletin_category = NewsBulletinCategory.new(:display => 'List') diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb index f5c2b5e63..e845cbd14 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/back_end/news_bulletins_controller.rb @@ -1,7 +1,10 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController before_filter :authenticate_user! - before_filter :is_admin? + +# before_filter :for_admin_only,:only => [:] +# before_filter :for_app_manager,:only => [:index,:show,] + before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_news_bulletins] def index # @news_bulletins = NewsBulletin.all @@ -39,6 +42,10 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController @news_bulletin_link = NewsBulletinLink.new @link_url = panel_news_back_end_news_bulletins_path + @news_bulletins.delete_if{ |news_bulletin| + news_bulletin.is_pending == true && (!news_bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || news_bulletin.create_user_id!=current_user.id) + } + @news_bulletin_file = NewsBulletinFile.new @file_url = panel_news_back_end_news_bulletins_path @@ -75,17 +82,19 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController def new @news_bulletin = NewsBulletin.new - @link_url = panel_news_back_end_news_bulletins_path + @link_url = panel_news_back_end_news_bulletins_path # @news_bulletin.news_bulletin_files.build # @news_bulletin.news_bulletin_files.new - - get_categorys - get_tags - - respond_to do |format| - format.html # new.html.erb - format.xml { render :xml => @news_bulletin } + if get_categorys.empty? + flash[:alert] = t("announcement.error.no_avilb_cate_for_posting") + redirect_to :action => :index + else + get_tags + respond_to do |format| + format.html # new.html.erb + format.xml { render :xml => @news_bulletin } + end end end @@ -311,10 +320,11 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController def get_categorys(id = nil) @news_bulletin_categorys = [] + @unit_list_for_anc = UnitListForAnc.all if(is_manager? || is_admin?) @news_bulletin_categorys = (id ? NewsBulletinCategory.find(id).to_a : NewsBulletinCategory.excludes('disabled' => true)) elsif is_sub_manager? - @news_bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit_new') + @news_bulletin_categorys = NewsBulletinCategory.authed_for_user(current_user,'submit') end end @@ -323,86 +333,4 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController @tags = Tag.all(:conditions => {:module_app_id => module_app.id}).order_by(I18n.locale, :asc) end - def get_sorted_and_filtered_news_bulletins - news_bulletins = NewsBulletin.all - case params[:sort] - when 'postdate', 'deadline' - news_bulletins = news_bulletins.order_by([params[:sort], params[:direction]]) - when 'category' - category_ids = news_bulletins.distinct(:news_bulletin_category_id) - categories = NewsBulletinCategory.find(category_ids) rescue nil - if categories - h = Hash.new - categories.each { |category| h[category.i18n_variable[I18n.locale]] = category.id } - sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse! - sorted_categorys = sorted.collect {|a| news_bulletins.where(:news_bulletin_category_id => a[1]).entries } - news_bulletins = sorted_categorys.flatten! - end - when 'title' - h = Array.new - news_bulletins.each { |news_bulletin| h << [news_bulletin.title[I18n.locale].downcase, news_bulletin] } - sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse! - news_bulletins = sorted.collect {|a| a[1] } - when 'status' - news_bulletins = news_bulletins.order_by(:is_top, params[:direction]).order_by(:is_hot, params[:direction]).order_by(:is_hidden, params[:direction]).order_by(:is_pending, params[:direction]).order_by(:is_checked, params[:direction]).order_by(:is_rejected, params[:direction]) - when 'update_user_id' - user_ids = news_bulletins.distinct(:update_user_id) - users = User.find(user_ids) rescue nil - if users - h = Array.new - users.each { |user| h << [user.name, user.id] } - sorted = params[:direction].eql?('asc') ? h.sort : h.sort.reverse! - sorted_users = sorted.collect {|a| news_bulletins.where(:update_user_id => a[1]).entries } - news_bulletins = sorted_users.flatten - end - when 'tags' - a = Array.new - NewsTag.all.order_by(I18n.locale, params[:direction]).each { |tag| a << tag.news_bulletins } - a.flatten! - a.uniq! - tmp = Array.new - news_bulletins.where(:tag_ids => []).each { |news_bulletin| tmp << [news_bulletin.title[I18n.locale].downcase, news_bulletin] } - sorted = params[:direction].eql?('asc') ? tmp.sort : tmp.sort.reverse! - sorted_titles = sorted.collect {|a| a[1] } - a = params[:direction].eql?('asc') ? (sorted_titles + a) : (a + sorted_titles) - news_bulletins = a.flatten - end - if @filter - @filter.each do |key, value| - case key - when 'status' - a = Array.new - news_bulletins.each do |news_bulletin| - value.each do |v| - case v - when 'pending' - a << news_bulletin if news_bulletin.is_checked.nil? - when 'rejected' - a << news_bulletin if news_bulletin.is_checked.eql?(false) - else - a << news_bulletin if news_bulletin[v] - end - end - end - news_bulletins = a.uniq - when 'categories' - a = Array.new - news_bulletins.each do |news_bulletin| - a << news_bulletin if value.include?(news_bulletin.news_bulletin_category.id.to_s) - end - news_bulletins = a.uniq - when 'tags' - a = Array.new - news_bulletins.each do |news_bulletin| - news_bulletin.tags.each do |tag| - a << news_bulletin if value.include?(tag.id.to_s) - end - end - news_bulletins = a.uniq - end if value.size > 0 - end - end - Kaminari.paginate_array(news_bulletins).page(params[:page]).per(10) - end - end diff --git a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb index 12d0cac69..bf51d3086 100644 --- a/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb +++ b/vendor/built_in_modules/news/app/controllers/panel/news/front_end/news_bulletins_controller.rb @@ -24,10 +24,19 @@ class Panel::News::FrontEnd::NewsBulletinsController < OrbitWidgetController end def show - @news_bulletin = NewsBulletin.can_display.where(_id: params[:id]).first - get_categorys + if params[:preview] == "true" + preview_content + else + @news_bulletin = NewsBulletin.can_display.where(_id: params[:id]).first + get_categorys + end end + def preview_content + @news_bulletins = NewsBulletin.find params[:id] + get_categorys + render :show + end protected diff --git a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb new file mode 100644 index 000000000..8ad75108e --- /dev/null +++ b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletin_categorys_helper.rb @@ -0,0 +1,14 @@ +module Panel::News::BackEnd::NewsBulletinCategorysHelper +include ActionView::Helpers::UrlHelper + + + def show_submit_permission_link(news_bulletin_category) + oa = news_bulletin_category.get_object_auth_by_title('submit') + if oa.nil? + news_bulletin_category.object_auths.new(title: 'submit' ).save + oa = news_bulletin_category.get_object_auth_by_title('submit') + end + link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa) + end + +end \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb new file mode 100644 index 000000000..666bcf4ea --- /dev/null +++ b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb @@ -0,0 +1,9 @@ +module Panel::News::BackEnd::NewsBulletinsHelper + + def news_show_approval_link(news_bulletin) + by_news_bulletin = (!news_bulletin.is_expired? and !news_bulletin.is_checked?) + by_user = news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) or is_manager? + by_news_bulletin and by_user + end + +end \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/models/news_bulletin.rb b/vendor/built_in_modules/news/app/models/news_bulletin.rb index 101ed5d2b..538180dcb 100644 --- a/vendor/built_in_modules/news/app/models/news_bulletin.rb +++ b/vendor/built_in_modules/news/app/models/news_bulletin.rb @@ -33,6 +33,7 @@ class NewsBulletin mount_uploader :image, ImageUploader belongs_to :news_bulletin_category + belongs_to :unit_list_for_anc # embeds_many :news_bulletin_links, :cascade_callbacks => true # embeds_many :news_bulletin_files, :cascade_callbacks => true diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_modal_approve.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_modal_approve.html.erb new file mode 100644 index 000000000..83a7b38f2 --- /dev/null +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/_modal_approve.html.erb @@ -0,0 +1,69 @@ + <% if news_bulletin -%> + + + + + +<% end -%> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/preview_and_approve.js.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/preview_and_approve.js.erb new file mode 100644 index 000000000..4191ae04d --- /dev/null +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_approvals/preview_and_approve.js.erb @@ -0,0 +1,5 @@ +$('#show_preview').html("<%= escape_javascript(render(:partial => 'modal_approve',:locals => {:news_bulletin => @news_bulletin})) %>"); +var start_modal_with_id = "news_bulletin-<%=@news_bulletin.id%>"; +$("#"+start_modal_with_id).css("width","1050px"); +$("#"+start_modal_with_id).css("height","768px"); +$("#"+start_modal_with_id).css("margin","-270px 0 0 -550px"); \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb index 01d58f986..377091bde 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb @@ -4,8 +4,14 @@ <%= news_bulletin_category.key %>
    diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/index.html.erb index caa4981f9..c876b6c84 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/index.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/index.html.erb @@ -17,7 +17,7 @@ -
    <%= render :partial => "form" %>
    +
    <%= render :partial => "form" if is_manager? %>
    diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb index c7dfd1558..38c2db316 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb @@ -105,28 +105,6 @@
  • -

    Audit

    -
    - - <% if is_manager? || @news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) || current_user.admin? %> -
    - <%= f.label :approval_stat, t('news.news_bulletin.approval_stat') %> - <%= content_tag :label,:class => "radio inline" do -%> - <%= f.radio_button :is_checked, true , {:class => 'privacy'} %> - <%= t('news.news_bulletin.approval_pass') %> - <% end -%> - <%= content_tag :label,:class => "radio inline" do -%> - <%= f.radio_button :is_checked, false, (!@news_bulletin.is_checked ? {:checked => true, :class => 'privacy'} : {})%> - <%= t('news.news_bulletin.approval_not_pass') %> - <% end -%> -
    - <%= label :is_checked_false, t('news.news_bulletin.approval_not_pass_reason') %> - <%= f.text_field :not_checked_reason %> -
    - -
    - <% end %> -
    <% elsif current_user.admin? %> <%= f.hidden_field :is_checked,:value => true%> @@ -139,13 +117,16 @@
    - + + <%= f.label :unit_list_for_anc%> + <%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %> + <%= f.label :category %> <%= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> @@ -153,7 +134,7 @@
    <%# @site_valid_locales.each_with_index do |locale, i| %> - <% site_valid_locales_default_head.each_with_index do |locale, i| %> + <% @site_valid_locales.each_with_index do |locale, i| %>
    "> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb index c800bf18b..b84e89b9a 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb @@ -1,5 +1,9 @@ - <%= check_box_tag 'to_delete[]', news_bulletin.id, false, :class => "checkbox_in_list" %> + + <% if (news_bulletin.create_user_id == current_user.id) || is_manager? %> + <%= check_box_tag 'to_delete[]', news_bulletin.id, false, :class => "checkbox_in_list" %> + <% end -%> +
    @@ -27,27 +31,33 @@ <%= news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] %> <%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''%> +
    diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb index 78535138b..742293fe7 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb @@ -5,8 +5,11 @@ <% end %> -
    - <%= paginate @news_bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %> +
    + <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary' %> +
    + <%= paginate @news_bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %> +
    - -
    - <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary' %> -
    <% content_for :page_specific_javascript do %> <%= javascript_include_tag "news_bulletin_form" %> + <%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %> + <%= javascript_include_tag "inc/modal-preview" %> <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb index 37e3e1f33..14659c077 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb @@ -4,7 +4,7 @@
    @@ -14,58 +14,18 @@
    <%= @news_bulletin.text[I18n.locale].html_safe %>
    + +<%= t('announcement.link') %> +<% @news_bulletin.bulletin_links.each do | blink | %> + <%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %> +<% end %> + +
  • +<%= t('announcement.file') %> +<% @news_bulletin.bulletin_files.each do | bfile | %> +<%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %> +<% end %> +
    - - -<%#= link_back %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb index 756d71023..2103f997c 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/index.html.erb @@ -2,7 +2,20 @@ <% if @news_bulletins and !@news_bulletins.nil? %>

    <%= t('news.campus_news')%>

    - <%= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %> + <%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %> +
    + + <%= t('news.more') %> + + + +
    previous page
    next page
      diff --git a/vendor/built_in_modules/news/config/routes.rb b/vendor/built_in_modules/news/config/routes.rb index aaf688019..b7882d2db 100644 --- a/vendor/built_in_modules/news/config/routes.rb +++ b/vendor/built_in_modules/news/config/routes.rb @@ -6,6 +6,8 @@ Rails.application.routes.draw do match 'update_setting' => "news_approvals#update_setting" ,:as => :news_approval_update_setting resources :news_bulletins do + match "approve/:news_bulletin_id" => "approvals#preview_and_approve",:as => :approval_preview,:via => :put + match "approve/:news_bulletin_id" => "approvals#approve",:as => :approve,:via => :post match "link_quick_add/:news_bulletin_id" => "news_bulletins#link_quick_add" ,:as => :link_quick_add match "link_quick_edit/:news_bulletin_id" => "news_bulletins#link_quick_edit" ,:as => :link_quick_edit member do @@ -31,7 +33,9 @@ Rails.application.routes.draw do resources :tags end namespace :front_end do - resources :news_bulletins + resources :news_bulletins # do + # match "preview" => "news_bulletins#preview_content",:as => :get_preview_content + # end end namespace :widget do match "news_bulletins" => "news_bulletins#index" diff --git a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb index 87f3447c2..6ae315fbf 100644 --- a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb +++ b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb @@ -5,11 +5,12 @@ class Panel::PageContent::BackEnd::PageContextsController < OrbitBackendControll def index - @page_contexts = PageContext.where(:archived => false).desc(:updated_at).page(params[:page]).per(10) + @page_contexts = params[:sort] ? get_sorted_and_filtered("page_contexts", {:archived => false}) : PageContext.where(:archived => false).page(params[:page]).per(10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @page_contexts } + format.js {} end end diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_filter.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_filter.html.erb new file mode 100644 index 000000000..02ba839b1 --- /dev/null +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_filter.html.erb @@ -0,0 +1,11 @@ + + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "sort_header" %> +<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_sort_headers.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_sort_headers.html.erb new file mode 100644 index 000000000..7a37d4a76 --- /dev/null +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_sort_headers.html.erb @@ -0,0 +1,4 @@ +<%= render_sort_bar(false, ['name', 'page','span7', 'page_context.name'], + ['version', 'version', 'span2', 'page_context.version'], + ['update_time', 'updated_at', 'span2', 'page_context.update_time'], + ['last_modified', 'update_user_id', 'span2', 'page_context.last_modified']).html_safe %> diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/index.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/index.html.erb index a71c45ebc..1ab0f27ae 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/index.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/index.html.erb @@ -1,22 +1,6 @@ <%= flash_messages %> - - +<%= render 'filter' %> @@ -27,13 +11,13 @@ - + <%= render :partial => 'page_context', :collection => @page_contexts %>
      -<%= paginate @page_contexts %> - - +
      + <%= paginate @page_contexts, :params => {:direction => params[:direction], :sort => params[:sort]} %> +
      diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/index.js.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/index.js.erb new file mode 100644 index 000000000..aba5dd93d --- /dev/null +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/index.js.erb @@ -0,0 +1,3 @@ +$("#sort_headers").html("<%= j render 'sort_headers' %>"); +$("#tbody_page_contexts").html("<%= j render :partial => 'page_context', :collection => @page_contexts %>"); +$("#page_context_pagination").html("<%= j paginate @page_contexts, :params => {:direction => params[:direction], :sort => params[:sort]} %>"); \ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb index 25c41606c..69aa8c1af 100644 --- a/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb +++ b/vendor/built_in_modules/web_resource/app/controllers/panel/web_resource/back_end/web_links_controller.rb @@ -122,6 +122,13 @@ class Panel::WebResource::BackEnd::WebLinksController < OrbitBackendController format.js end end + + def delete + if params[:to_delete] + web_links = WebLink.any_in(:_id => params[:to_delete]).delete_all + end + redirect_to panel_web_resource_back_end_web_links_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) + end protected diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_sort_headers.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_sort_headers.html.erb index e405811c5..8873ed20c 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_sort_headers.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_sort_headers.html.erb @@ -1,4 +1,4 @@ -<%= render_sort_bar(false, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1', 'bulletin.status'], +<%= render_sort_bar(true, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1', 'bulletin.status'], ['category', 'bulletin_category', 'span2', 'bulletin.category'], ['name', 'name','span3', 'bulletin.title'], ['tags', 'tags', 'span2', 'bulletin.tags']).html_safe %> \ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_web_link.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_web_link.html.erb index ad8f5adec..457a05a86 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_web_link.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_web_link.html.erb @@ -1,4 +1,9 @@ + + <% if (web_link.create_user_id == current_user.id) || is_manager? %> + <%= check_box_tag 'to_delete[]', web_link.id, false, :class => "checkbox_in_list" %> + <% end -%> +
      diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb index aa8670347..da1e287b9 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb @@ -1,17 +1,20 @@ -<%= render 'filter' %> - - - - - - - - - - - <%= render :partial => 'web_link', :collection => @web_links %> - -
      +<%= form_for :news_bulletins, :url => delete_panel_web_resource_back_end_web_links_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %> + <%= render 'filter' %> + + + + + + + + + + + + <%= render :partial => 'web_link', :collection => @web_links %> + +
      +<% end %>