diff --git a/Guardfile b/Guardfile new file mode 100644 index 00000000..4f561da0 --- /dev/null +++ b/Guardfile @@ -0,0 +1,22 @@ +guard 'livereload' do + watch(%r{app/.+\.(erb|haml)}) + watch(%r{app/helpers/.+\.rb}) + watch(%r{public/.+\.(css|js|html)}) + watch(%r{config/locales/.+\.yml}) +end + +guard 'rspec', :version => 2 do + watch(%r{^spec/.+_spec\.rb}) + watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { "spec" } + + # Rails example + watch('spec/spec_helper.rb') { "spec" } + watch('config/routes.rb') { "spec/routing" } + watch('app/controllers/application_controller.rb') { "spec/controllers" } + watch(%r{^spec/.+_spec\.rb}) + watch(%r{^app/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^lib/(.+)\.rb}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch(%r{^app/controllers/(.+)_(controller)\.rb}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] } + watch(%r{^app/views/(.+)/}) { |m| "spec/requests/#{m[1]}_spec.rb" } +end \ No newline at end of file diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 17b14841..2b4eb629 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -332,9 +332,9 @@ var orbitDesktop = function(dom){ if(j==0)$group.attr("id",tile.group_id); if(tile.data_category == "app") - $li = $('
  • '+tile.title+'

  • '); + $li = $('
  • '+tile.title+'

  • '); else - $li = $('
  • '+tile.title+'

    Loading...
  • '); + $li = $('
  • '+tile.title+'

    Loading...
  • '); $group.find('.col'+colindex).append($li); } @@ -1557,10 +1557,10 @@ var orbitDesktop = function(dom){ var widget = $(this); if(widget.attr("data-category")=="widget"){ var widgename = widget.attr("data-content"); - $.getScript("/desktop_widgets/"+widgename+"/"+widgename+".js",function(){ - widget.find("div.appholder").load("/desktop_widgets/"+widgename+"/index.html.erb"); + $.getScript(widget.attr("js-link"),function(){ + widget.find("div.appholder").load(widget.attr("data-content")); }); - // $(this).find("div.appholder").append( $('').attr('href', "/desktop_widgets/"+widgename+"/css/"+widgename+".css")); + $(this).find("div.appholder").append( '') } }) @@ -1697,3 +1697,4 @@ orbitDesktop.prototype.currentUsername = "Harry"; var uselessfunction = function(){ $.post("/desktop/temp_func",{sectionid:"4f83e7bbbd98eb041600001d"}); } + diff --git a/app/assets/stylesheets/member.css b/app/assets/stylesheets/member.css index 436a9b6a..add8774a 100644 --- a/app/assets/stylesheets/member.css +++ b/app/assets/stylesheets/member.css @@ -287,36 +287,42 @@ padding: 0 20px 0 150px !important; margin: 20px 0 0; } -.user-role .user-info { +.role-block .user-info { top: 23px; margin-left: -135px; width: 100px; border-right: none; box-shadow: none; } -.user-role .map-block h4 .gender { +.role-block .map-block h4 .gender { top: -1px; bottom: auto; left: -1px; right: auto; border-radius: 4px 0 0 0; } -.user-role .teacher h4 .gender { +.role-block .teacher h4 .gender { border-color: #186AB6 transparent transparent #186AB6; } -.user-role .student h4 .gender { +.role-block .student h4 .gender { border-color: #F38C08 transparent transparent #F38C08; } -.user-role .staff h4 .gender { +.role-block .staff h4 .gender { border-color: #139E2F transparent transparent #139E2F; } -.user-role .tab-content, .user-role .nav-pills { +.role-block .tab-content, .role-block .nav-pills { float: left; } -.user-role .nav-pills { - margin-left: 10px; +.role-block .nav-pills { + margin-bottom: 0;g } -.plural .input-append input, .plural .input-append select, .plural .input-append .uneditable-input { +.role-block .nav-pills > li > a { + margin-top: 0; +} +/*.role-block .control-group .inline { + float: +}*/ +.plural .input-append input, .plural .input-append select, .plural .input-append .uneditable-input, .unRadius input { -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; @@ -338,4 +344,8 @@ -webkit-border-radius: 0 3px 3px 0; -moz-border-radius: 0 3px 3px 0; border-radius: 0 3px 3px 0; +} +.language-swich .tab-pane { + margin-bottom: 5px; + margin-right: 10px; } \ No newline at end of file diff --git a/app/assets/stylesheets/site-map.css b/app/assets/stylesheets/site-map.css index d7d3cda6..53e94c1f 100644 --- a/app/assets/stylesheets/site-map.css +++ b/app/assets/stylesheets/site-map.css @@ -81,37 +81,60 @@ background-color: #5EB92B; font-size: 9px; padding: 0px 10px; - border-radius: 8px; - line-height: 16px; - height: 15px; + border-radius: 11px; + line-height: 20px; + height: 19px; color: #FFF; - width: 38px; + width: 40px; border: none; box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5), 0 0 5px rgba(13, 75, 23, 0.5) inset; - margin-top: 2px; + margin-top: 1px; } /* for mamber role */ - -.user-role .form-horizontal { +.role-block .form-horizontal { padding: 20px 10px 10px; background-color: #FFF; margin-bottom: 0; border-radius: 0 0 4px 4px; } -.user-role .form-horizontal .control-label { +.role-block [class*="type"] { + background-color: #F1F1F1; + padding: 20px 0 10px; + border-radius: 5px; + margin: -25px 0 40px; + /*box-shadow: 0px 1px 3px rgba(100,100,100,.4)*/ +} +.role-block .form-horizontal .control-label { width: 100px; } -.user-role .form-horizontal .controls { +.role-block .form-horizontal .controls { margin-left: 120px; } -.user-role .form-horizontal .controls>.input-append { +.role-block .form-horizontal .controls>.input-append { margin-bottom: 10px; } -.user-role .map-block { +.role-block .form-horizontal legend .onoff { + margin-top: 4px; +} +.role-block .form-horizontal legend .btn-danger { + margin-right: 20px; +} +.role-block .form-horizontal legend>.clear { + margin-right: 150px; + min-width: 350px; +} +.role-block .map-block { min-width: 440px; } -.user-role .map-block legend { +.role-block .map-block .form-actions { + margin: 0; + padding: 10px 20px; +} +.role-block .map-block legend { font-size: 18px; line-height: 25px; } +.role-block .map-block legend .nav { + font-size: 12px; +} diff --git a/app/controllers/admin/infos_controller.rb b/app/controllers/admin/infos_controller.rb index 5ffa6a06..cec5c5f4 100644 --- a/app/controllers/admin/infos_controller.rb +++ b/app/controllers/admin/infos_controller.rb @@ -1,10 +1,11 @@ class Admin::InfosController < ApplicationController - layout "admin" + layout "new_admin" before_filter :authenticate_user! before_filter :is_admin? before_filter :set_attribute, :only => [:index, :show, :new, :edit] - + helper Admin::AttributeValuesViewHelper + def index @attributes = Info.all.entries render :template => 'admin/attributes/index' @@ -32,8 +33,8 @@ class Admin::InfosController < ApplicationController def update @attribute = Info.find(params[:id]) - # binding.pry @attribute.update_attributes(params[:info]) + @attribute.attribute_fields.each{|t| t.destroy if t["to_delete"] == true} respond_to do |format| format.html { redirect_to :action => :index } format.js { render 'admin/attributes/toggle_enable' } @@ -47,10 +48,10 @@ class Admin::InfosController < ApplicationController end def add_attribute_field - @attribute = Info.find(params[:id]) rescue nil - if !@attribute - @attribute = Info.new - end + attribute = Info.find(params[:info_id]) rescue nil + @attribute_field_counter = attribute.attribute_fields.count + @attribute_field = attribute.attribute_fields.build + @attribute_field.save end protected diff --git a/app/controllers/admin/users_new_interface_controller.rb b/app/controllers/admin/users_new_interface_controller.rb index faf14f3a..95be536e 100644 --- a/app/controllers/admin/users_new_interface_controller.rb +++ b/app/controllers/admin/users_new_interface_controller.rb @@ -33,14 +33,10 @@ class Admin::UsersNewInterfaceController < ApplicationController @student_data = [] @staff_data = [] - - attribute_values = @user.attribute_values.reject{|att_val| - # binding.pry if(att_val.id.to_s == '507fa1295789b52a540000e0') - !att_val.attribute_field.locale and (att_val.attribute_field.neutral_for != I18n.locale.to_s) - } - + attribute_values = @user.attribute_values attribute_values.each{|att_val| - @profile_data.push({:name => att_val.attribute_field.title,:value =>att_val.get_value_by_locale(I18n.locale)}) if att_val.attribute_field.attribute.key=="profile" rescue false + binding.pry if att_val.id.to_s == '5052dab52b5c49ae9d000006' + @profile_data.push({:name => att_val.attribute_field.title,:value =>att_val.get_value_by_locale(I18n.locale.to_s)}) if att_val.attribute_field.attribute.key=="profile" rescue false } @@ -75,7 +71,6 @@ class Admin::UsersNewInterfaceController < ApplicationController end def create - binding.pry puts params.to_yaml # attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values' # attribute_values = params[:user].delete(attribute_values_key) @@ -84,6 +79,7 @@ class Admin::UsersNewInterfaceController < ApplicationController # @user.attribute_values.build(value) # } # @user.rebuild_sub_roles_from_attribute_values!(attribute_values) + binding.pry if @user.save flash[:notice] = t('create.success.user') redirect_to :action => :index diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index 286ec1c4..ff657441 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -103,11 +103,41 @@ class DesktopController< ApplicationController def getgroups @section = Section.find(params["sectionid"]) @groups = @section.groups - a = Array.new + + gr = Array.new @groups.each do |group| - a << group.tiles + a = Array.new + t = group.tiles + t.each do |tile| + data_content = "" + jsfile = [] + cssfile = "" + shape = "w1 h1" + if tile.data_category == "widget" + widge = DesktopWidget.find(tile.desktop_widget_id.to_s) + # data_content = widge.widget_layout.file + data_content = "desktop/widget_layout?id="+tile.desktop_widget_id.to_s + jsfile = widge.javascripts.collect{|js| js.file} + cssfile = widge.css_default.file + shape = widge.shape + title = widge.name + else + data_content = tile.data_content + title = tile.title + end + a << {"id"=>tile.id,"data_category"=>tile.data_category,"data_content"=>data_content,"js"=>jsfile,"css"=>cssfile,"shape"=>shape,"position"=>tile.position,"title"=>title} + end + gr << a end - render :json =>a.to_json + render :json =>gr.to_json + end + + def widget_layout + widget = DesktopWidget.find(params[:id]) + link = '' + content = widget.widget_layout.body + dhtml = link + content + render :text => dhtml.html_safe end def getsectionlist diff --git a/app/controllers/desktop_publications_controller.rb b/app/controllers/desktop_publications_controller.rb index 14307022..fc3f36ab 100644 --- a/app/controllers/desktop_publications_controller.rb +++ b/app/controllers/desktop_publications_controller.rb @@ -8,6 +8,7 @@ class DesktopPublicationsController< ApplicationController end def journal_p_add + debugger render "desktop/journal_pages/add", :layout => false end diff --git a/app/controllers/desktop_widgets_controller.rb b/app/controllers/desktop_widgets_controller.rb new file mode 100644 index 00000000..2605f367 --- /dev/null +++ b/app/controllers/desktop_widgets_controller.rb @@ -0,0 +1,62 @@ +class DesktopWidgetsController < OrbitBackendController + require "net/http" + require "uri" + require 'zip/zip' + + def index + end + + def upload + if !params[:desktop_widget].nil? + temp_file = Tempfile.new("temp_file") + original_file = params[:desktop_widget][:package_file] + #if original_file.content_type == 'application/zip' + temp_file.write(original_file.read.force_encoding('UTF-8')) + temp_file.rewind + filename = File.basename(original_file.original_filename,".zip") + unzip_widget(temp_file, filename) + #else + # flash[:error] = "Upload file should be in zip format" + #end + temp_file.close + end + end + + def unzip_widget(file, zip_name) + Zip::ZipFile.open(file) { |zip_file| + dw = DesktopWidget.new.from_json(zip_file.read("#{zip_name}/settings.json")) + Dir.mktmpdir('f_path') { |dir| + javascripts_entries = [] + images_entries = [] + + zip_file.entries.each do |entry| + case (path = entry.to_s) + when /\A(#{zip_name})\/(default\.css)\z/ + #for default css + dw.build_css_default(:file => get_temp_file(zip_file, dir, entry)) + when /\A(#{zip_name})\/(widget\.html)\z/ #for layout html + dw.build_widget_layout(:file => get_temp_file(zip_file, dir, entry)) + when /\A(#{zip_name})\/(javascripts)\/.*(\.js)\z/ #for js + javascripts_entries << entry + when /\A(#{zip_name})\/(images)\/.*((\.jpg)|(\.png)|(\.gif))\z/ #for img + images_entries << entry + end + end + + ['javascripts', 'images'].each do |type| + eval("#{type}_entries").each do |entry| + eval("dw.#{type}").build(:file => get_temp_file(zip_file, dir, entry)) + end + end + } + dw.save + } + end + def get_temp_file(zip_file, dir, entry) + filename = File.basename(entry.to_s) + temp_file = File.new(dir + '/' + filename, 'w+') + temp_file.write (zip_file.read entry ).force_encoding('UTF-8') + temp_file + end + +end \ No newline at end of file diff --git a/app/controllers/otheraccounts_controller.rb b/app/controllers/otheraccounts_controller.rb index 454f108e..d946bd3c 100644 --- a/app/controllers/otheraccounts_controller.rb +++ b/app/controllers/otheraccounts_controller.rb @@ -1,4 +1,4 @@ -class OtheraccountsController< ApplicationController +class Desktop::OtheraccountsController< ApplicationController require 'open-uri' require 'rexml/document' require 'net/http' diff --git a/app/helpers/admin/attribute_values_view_helper.rb b/app/helpers/admin/attribute_values_view_helper.rb new file mode 100644 index 00000000..9a724c96 --- /dev/null +++ b/app/helpers/admin/attribute_values_view_helper.rb @@ -0,0 +1,16 @@ +module Admin::AttributeValuesViewHelper + OPT = [ + ["YYYY / MM / DD hh : mm","format1"], + ["YYYY / MM / DD","format2"], + ["YYYY / MM","format3"], + ["YYYY","format4"] + ] + def show_type_panel(attribute_field,type) + markup = attribute_field.markup + LIST[:markups][markup]["panel"] == type ? type : [type,'hide'].join(" ") + end + + def name_to_id(str) + str.gsub(/\]/,'').gsub(/\[/,"_") + end +end \ No newline at end of file diff --git a/app/helpers/attribute_fields_helper.rb b/app/helpers/attribute_fields_helper.rb index af805daa..9050b9e6 100644 --- a/app/helpers/attribute_fields_helper.rb +++ b/app/helpers/attribute_fields_helper.rb @@ -9,14 +9,18 @@ module AttributeFieldsHelper include ActionView::Helpers::RenderingHelper def block_helper(user,index,disable = false) - @index = index - @markup_options = markup_options.merge(:disabled=>disable) - @user = user - @attribute_value = @user.get_value_from_field_id(id) - @new_attribute = @attribute_value.nil? - @attribute_value = @attribute_value || @user.attribute_values.build(attribute_field_id: id) - @prefiled_value = @attribute_value.get_values - return instance_eval("render_#{markup}") #rescue "" + unless self.disabled + @index = index + @markup_options = markup_options.merge(:disabled=>disable,:func=>"input_unit") + @user = user + @attribute_value = @user.get_value_from_field_id(id) + @new_attribute = @attribute_value.nil? + @attribute_value = @attribute_value || @user.attribute_values.build( attribute_field_id: id ) + @prefiled_value = @attribute_value.value + @panel_setting = self.get_data + return instance_eval("render_#{markup}") #rescue "" + + end end def lang_tab(str,lang) @@ -24,6 +28,7 @@ module AttributeFieldsHelper end def render_address + #NP control_group_wrapper do |key,value| result = '
    '.html_safe @@ -44,36 +49,55 @@ module AttributeFieldsHelper end def render_checkbox + @prefiled_value ||=[] - markup_value = eval(self.markup_value) rescue {} + # begin + # markup_value = eval(self.markup_value) + # rescue + # markup_value = self.markup_value + # ensure + # markup_value ||= {} + # end + control_group_wrapper do - markup_value.collect do |key,value| - label_tag(key,check_box_tag(get_field_name_base+"[value][#{key}]", value[I18n.locale.to_s], (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"control-label")) + a = self[:option_list].collect do |key,value| + label_tag(key,check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"control-label")) end.join rescue "" end end def render_date - control_group_wrapper{date_select(get_field_name_base+"[value]",nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")} + #NP + control_group_wrapper{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")} end def render_date_durnation #Need re-write low priority - + end def render_radio_button @prefiled_value ||=[] - markup_value = eval(self.markup_value) rescue {} + # begin + # markup_value = eval(self.markup_value) + # rescue + # markup_value = self.markup_value + # ensure + # markup_value ||= {} + # end control_group_wrapper do - markup_value.collect do |key,value| - label_tag(key,radio_button_tag(get_field_name_base+"[value][#{key}]", value[I18n.locale.to_s], (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"control-label")) - end.join rescue "" + self[:option_list].collect do |key,value| + label_tag(key,radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {})+value[I18n.locale.to_s],@markup_options.merge(:class=>"control-label")) + end.join end end def render_select - markup_value = (self.markup_value.is_a?(Hash) ? self.markup_value : eval(self.markup_value) )rescue {} - control_group_wrapper{select_tag( get_field_name_base+"[value]",options_for_select(markup_value.collect{|p| [p[1][I18n.locale.to_s],p[0]]},@prefiled_value),@markup_options)} rescue "" + + prompt = @panel_setting[:prompt][I18n.locale] rescue nil + @markup_options.merge!(:prompt => prompt) unless prompt.nil? + # markup_value = (self.markup_value.is_a?(Hash) ? self.markup_value : eval(self.markup_value) )rescue {} + # check self[:option_list].collect{|p| [p[1][I18n.locale.to_s],p[0]]} + control_group_wrapper{select_tag( get_field_name_base,options_for_select(self.option_list.collect{|p| [p[1][I18n.locale.to_s],p[0]]},@prefiled_value),@markup_options)} rescue "" end def render_text_area @@ -81,28 +105,35 @@ module AttributeFieldsHelper if(add_more and value.is_a?(Hash)) values = value values.each_with_index.collect do |value,index| - text_area_tag(get_field_name_base + (key.nil? ? '' : "[#{key}][#{index}]"), value.last,@markup_options) + place_holder= @panel_setting["placeholder"][key] + text_area_tag(get_field_name_base + (key.nil? ? '' : "[#{key}][#{index}]"), value.last,@markup_options.merge(:placeholder=>place_holder)) end.join.html_safe else value = can_muti_lang_input ? @prefiled_value[key] : @prefiled_value - key = can_muti_lang_input ? "[#{key}]" : "[value]" - text_area_tag(get_field_name_base + key, value,@markup_options) + key = can_muti_lang_input ? "[#{key}]" : "" + place_holder= @panel_setting["placeholder"][I18n.locale.to_s] rescue '' + text_area_tag(get_field_name_base + key, value,@markup_options.merge(:placeholder=>place_holder)) end end end def render_text_field control_group_wrapper do |key,value| - if(add_more and value.is_a?(Hash)) + if(add_more) values = value - values.each_with_index.collect do |value,index| - - text_field_tag(get_field_name_base + (key.nil? ? '' : "[#{key}][#{index}]"), value.last,@markup_options) - end.join.html_safe + result = "" + unless values.nil? + result = values.each_with_index.collect do |value,index| + place_holder= @panel_setting["placeholder"][key] + text_field_tag(get_field_name_base + (key.nil? ? '' : "[#{key}][#{index}]"), value.last,@markup_options.merge(:placeholder=>place_holder)) + end.join.html_safe + end + result else - value = can_muti_lang_input ? @prefiled_value[key] : @prefiled_value - key = can_muti_lang_input ? "[#{key}]" : "[value]" - text_field_tag(get_field_name_base + key, value,@markup_options) + value = (can_muti_lang_input ? @prefiled_value[key] : @prefiled_value) rescue nil + key_field = can_muti_lang_input ? "[#{key}]" : "" + place_holder= @panel_setting["placeholder"][key] rescue '' + text_field_tag(get_field_name_base + key_field, value,@markup_options.merge(:placeholder=>place_holder)) end end end @@ -121,12 +152,14 @@ protected if can_muti_lang_input result << "
    " result << "
    " + VALID_LOCALES.collect do |key| value = @prefiled_value[key.to_s] rescue nil div_class = ["tab-pane" ,"fade"].join(" ") div_class << (key == I18n.locale.to_s ? " active in" : '') result << content_tag(:div,yield(key,value),:class=>div_class,:id=>"tab"+id.to_s+"_#{key}") end + result << "
    " result << "
    +
    +
    New Share
    +
    + +
    +
    @@ -72,4 +84,19 @@ - \ No newline at end of file + +Panel::PersonalJournal::Plugin::WritingJournals + diff --git a/app/views/desktop_widgets/upload.html.erb b/app/views/desktop_widgets/upload.html.erb new file mode 100644 index 00000000..19d3ff1a --- /dev/null +++ b/app/views/desktop_widgets/upload.html.erb @@ -0,0 +1,12 @@ +

    Upload Widget Package

    +
    + <%= form_tag '',:multipart => true,:action=>"post" do |f| %> + +

    + <%= file_field :desktop_widget,:package_file %> +

    + <%= submit_tag %> + + <% end %> + +
    \ No newline at end of file diff --git a/app/views/layouts/_side_bar_content.html.erb b/app/views/layouts/_side_bar_content.html.erb index 61888acc..66e4542d 100644 --- a/app/views/layouts/_side_bar_content.html.erb +++ b/app/views/layouts/_side_bar_content.html.erb @@ -81,7 +81,7 @@ <% end -%> <% end %> -<%= content_tag :li, :class => active_for_controllers('archive_files', 'tags', 'archive_file_categorys') do -%> +<%= content_tag :li, :class => active_for_controllers('archive_files', 'panel/archive/back_end/tags', 'archive_file_categorys') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-asset') + content_tag(:span, t('admin.archive')), panel_archive_back_end_archive_files_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('archive_files', 'tags', 'archive_file_categorys')) do -%> <%= content_tag :li, link_to((t('admin.all_articles') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, panel_archive_back_end_archive_files_path), :class => active_for_action('archive_file', 'index') %> @@ -91,14 +91,14 @@ <% end -%> <% end -%> -<%= content_tag :li, :class => active_for_controllers('cals') || active_for_app_auth("calendar") do -%> +<%= content_tag :li, :class => active_for_controllers('cals','panel/calendar/back_end/tags') || active_for_app_auth("calendar") do -%> <%= link_to content_tag(:i, nil, :class => 'icons-calendar') + content_tag(:span, t('admin.calendar')), panel_calendar_back_end_cals_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('cals','calendar_categories') ) do -%> <%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %> <%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %> <%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %> - <%= content_tag :li, link_to((t('calendar.calendars') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_calendar_back_end_cal_path), :class => active_for_action('cals','new') %> - <%#= content_tag :li, link_to(t('gallery.tags'), panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') %> + <%= content_tag :li, link_to((t('admin.calendars') + content_tag(:i, nil, :class => 'icon-chevron-right')).html_safe, new_panel_calendar_back_end_cal_path), :class => active_for_action('cals','new') %> + <%= content_tag :li, link_to(t('admin.tags'), panel_calendar_back_end_tags_path), :class => active_for_action('/panel/calendar/back_end/tags', 'index') %> <%#= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %> <% end -%> <% end %> diff --git a/app/views/shared/_address_modal_dialog.html.erb b/app/views/shared/_address_modal_dialog.html.erb new file mode 100644 index 00000000..6e241074 --- /dev/null +++ b/app/views/shared/_address_modal_dialog.html.erb @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/config/application.rb b/config/application.rb index ccc4a65e..f0e40fcc 100644 --- a/config/application.rb +++ b/config/application.rb @@ -33,6 +33,7 @@ module Orbit config.autoload_paths += %W(#{config.root}/app/models/meta) config.autoload_paths += %W(#{config.root}/app/models/purchase) config.autoload_paths += %W(#{config.root}/app/models/user) + config.autoload_paths += %W(#{config.root}/app/models/desktop) # Include all helpers # 'helper :all' must be removed in ApplicationController diff --git a/config/list.yml b/config/list.yml index b0cf253f..ebfff364 100644 --- a/config/list.yml +++ b/config/list.yml @@ -9,21 +9,27 @@ markups: text_field: muti_lang_input_supprt: true ext_support: true + panel: typeA select: muti_lang_input_supprt: false ext_support: false + panel: typeB date: muti_lang_input_supprt: false ext_support: false + panel: typeC text_area: muti_lang_input_supprt: true ext_support: false + panel: typeD radio_button: muti_lang_input_supprt: false ext_support: false + panel: typeE checkbox: muti_lang_input_supprt: false ext_support: false + panel: typeE # date_durnation: # muti_lang_input_supprt: false # ext_support: false diff --git a/config/locales/en.yml b/config/locales/en.yml index 621987ee..041e03d7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -158,6 +158,14 @@ en: user: Users list list_: List list_lower: list + lists: + markups: + text_field: Text Field + select: Select + date: Date + text_area: Text Area + radio_button: Radio button + checkbox: Checkbox login: Login logout: Logout mail: @@ -407,7 +415,7 @@ en: attributes: Attributes author: Author calendar: Calendar - gprs: GPRS + gprs: GPS cant_delete_self: You can not delete yourself. cant_revoke_self_admin: You can not revoke your admin role yourself. category: Category diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index ec2b34f3..efa69994 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -158,6 +158,14 @@ zh_tw: user: 使用者列表 list_: 列表 list_lower: 列表 + lists: + markups: + text_field: 文字輸入框 + select: 下拉選單 + date: 日期 + text_area: 文字輸入方塊 + radio_button: 單選 + checkbox: 多選 login: 登入 logout: 登出 mail: @@ -342,8 +350,30 @@ zh_tw: # : ======= errors: at_least_one: 必須至少有一個值 - admin: + infos: + add_attribute_field: 新增 + save: 儲存 + initial: 起始值 + markup: 輸入模式 + item_name: 資料表名稱 + name: 名稱 + options: 選項 + multilingual: 多語言輸入 + add_more: 使用者可自行延伸欄位 + add: 新增 + placeholder: 輸入協助 + type: 類型 + placeholder: 提示內容 + list: 自定選單 + is_range: 是 + not_range: 否 + date: + claendar: 紀年法 + range: 本欄為時間區段 + format: 格式 + tw_claendar: 民國 + west_claendar: 西元 access: denied: app: diff --git a/config/routes.rb b/config/routes.rb index 72841be5..27b87d90 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -141,7 +141,17 @@ Orbit::Application.routes.draw do resources :users end - match '/desktop/'=>'desktop#index' + resources :desktop_widgets do + collection do + get 'upload' + get 'delete' + post 'upload' + end + end + +namespace :desktop do + + match "/"=>"desktop#index" # Sinatra Routes start @@ -176,46 +186,50 @@ Orbit::Application.routes.draw do # Sinatra Routes end - match '/desktop/desktop'=>'desktop#desktop' - match '/desktop/app_manager'=>'desktop#app_manager' - match '/desktop/sections'=>'desktop#sections' - match '/desktop/settings'=>'desktop#settings' - match '/desktop/get_desktop_settings/'=>'desktop#get_desktop_settings' - match '/desktop/save_desktop_settings/'=>'desktop#save_desktop_settings' - match '/desktop/getgroups/'=>'desktop#getgroups' - match '/desktop/getsectionlist/'=>'desktop#getsectionlist' - match '/desktop/settingthemes/'=>'desktop#settingthemes' - match '/desktop/settingsections/'=>'desktop#settingsections' - match '/desktop/getapplist/'=>'desktop#getapplist' - match '/desktop/newpositions/'=>'desktop#newpositions' - match '/desktop/settingconnection/'=>'desktop#settingconnection' + match '/desktop'=>'desktop#desktop' + match '/app_manager'=>'desktop#app_manager' + match '/sections'=>'desktop#sections' + match '/settings'=>'desktop#settings' + match '/get_desktop_settings/'=>'desktop#get_desktop_settings' + match '/save_desktop_settings/'=>'desktop#save_desktop_settings' + match '/getgroups/'=>'desktop#getgroups' + match '/getsectionlist/'=>'desktop#getsectionlist' + match '/settingthemes/'=>'desktop#settingthemes' + match '/settingsections/'=>'desktop#settingsections' + match '/getapplist/'=>'desktop#getapplist' + match '/newpositions/'=>'desktop#newpositions' + match '/settingconnection/'=>'desktop#settingconnection' + match '/widget_layout' => 'desktop#widget_layout' - match '/desktop/journal_p/'=>'desktop_publications#journal_p' - match '/desktop/journal_p_list/'=>'desktop_publications#journal_p_list' - match '/desktop/journal_p_add/'=>'desktop_publications#journal_p_add' - match '/desktop_publications/getjournals' => 'desktop_publications#getjournals' - match '/desktop/books' => 'desktop_publications#books' - match '/desktop/books_list/'=>'desktop_publications#books_list' - match '/desktop/books_add/'=>'desktop_publications#books_add' + match '/journal_p/'=>'desktop_publications#journal_p' + match '/journal_p_list/'=>'desktop_publications#journal_p_list' + match '/journal_p_add/'=>'desktop_publications#journal_p_add' + match '/books' => 'desktop_publications#books' + match '/books_list/'=>'desktop_publications#books_list' + match '/books_add/'=>'desktop_publications#books_add' - match '/desktop/seminar_p' => 'desktop_publications#seminar_p' - match '/desktop/seminar_p_list/'=>'desktop_publications#seminar_p_list' - match '/desktop/seminar_p_add/'=>'desktop_publications#seminar_p_add' + match '/seminar_p' => 'desktop_publications#seminar_p' + match '/seminar_p_list/'=>'desktop_publications#seminar_p_list' + match '/seminar_p_add/'=>'desktop_publications#seminar_p_add' - match '/desktop/research_d' => 'desktop_research#research_d' - match '/desktop/research_d_list/' => 'desktop_research#research_d_list' - match '/desktop/research_d_add' => 'desktop_research#research_d_add' + match '/research_d' => 'desktop_research#research_d' + match '/research_d_list/' => 'desktop_research#research_d_list' + match '/research_d_add' => 'desktop_research#research_d_add' - match '/desktop/research_p' => 'desktop_research#research_p' - match '/desktop/research_p_list/' => 'desktop_research#research_p_list' - match '/desktop/research_p_add' => 'desktop_research#research_p_add' + match '/research_p' => 'desktop_research#research_p' + match '/research_p_list/' => 'desktop_research#research_p_list' + match '/research_p_add' => 'desktop_research#research_p_add' - match '/desktop/twitter/'=>'otheraccounts#twitter' - match '/desktop/forgmail/'=>'otheraccounts#gmail' - match '/desktop/getaccounts'=>'otheraccounts#getaccounts' - match '/desktop/save_account_info/'=>'otheraccounts#saveaccountinfo' + + match '/temp_func/'=>'desktop#temp_func' +end + + match '/twitter/'=>'otheraccounts#twitter' + match '/forgmail/'=>'otheraccounts#gmail' + match '/getaccounts'=>'otheraccounts#getaccounts' + match '/save_account_info/'=>'otheraccounts#saveaccountinfo' match '/desktop_appstore/appstore'=>'desktop_appstore#appstore' match '/desktop_appstore/widgets'=>'desktop_appstore#widgets' @@ -226,13 +240,14 @@ Orbit::Application.routes.draw do match '/desktop_orbit/eventajaxload'=> 'desktop_orbit#eventajaxload' match '/desktop_orbit/gettimelinespan' => 'desktop_orbit#gettimelinespan' + match '/desktop_publications/getjournals' => 'desktop_publications#getjournals' #match '/desktop_orbit/eventajaxload' => 'desktop_publications#create_journal' #match '/desktop_orbit/eventajaxload' => 'desktop_publications#delete_journal' # match '/desktop_orbit/eventajaxload' => 'desktop_publications#update_journal' - match '/desktop/temp_func/'=>'desktop#temp_func' + match '/panel/:app_name/front_end/:app_action/:id(/:controller_action)' => 'pages#show_from_link', :constraints => lambda { |request| !request.query_string.include?("inner=true") diff --git a/lib/parsers/parser_layout_widget.rb b/lib/parsers/parser_layout_widget.rb new file mode 100644 index 00000000..382657d8 --- /dev/null +++ b/lib/parsers/parser_layout_widget.rb @@ -0,0 +1,22 @@ +module ParserLayoutWidget + require 'nokogiri' + + def parse_widget_for_images(widget) + content = widget.widget_layout.file.read.force_encoding("UTF-8") + widge = Nokogiri::HTML(content) + a = [] + b = [] + widge.css('.widget_image').each do |page_image| + image = widget.images.where( file: File.basename(page_image['src']))[0] + a << page_image['src'] + b << image.file + image.update_attributes(:html_id => page_image['id'], :html_class => page_image['class'], :in_html => true) if image + end + a.each_with_index do |img,i| + content = content.gsub(img,b[i].to_s) + end + widget.widget_layout.update_attributes(:body => content) + end + + +end diff --git a/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/bg_blue.png b/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/bg_blue.png deleted file mode 100755 index ea275d1b..00000000 Binary files a/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/bg_blue.png and /dev/null differ diff --git a/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/bg_green.png b/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/bg_green.png deleted file mode 100755 index 393618c2..00000000 Binary files a/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/bg_green.png and /dev/null differ diff --git a/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/bg_orange.png b/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/bg_orange.png deleted file mode 100755 index 84d32207..00000000 Binary files a/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/bg_orange.png and /dev/null differ diff --git a/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/clock.css b/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/clock.css deleted file mode 100755 index 8790b137..00000000 --- a/public/desktop_widgets/4fa7810ac88514014d7c59bc/temp/clock.css +++ /dev/null @@ -1,69 +0,0 @@ -.clock{ - /* The .clock div. Created dynamically by jQuery */ - /*background-color:#252525;*/ - height:200px; - width:200px; - position:relative; - overflow:hidden; - float:left; -} - -.clock .rotate{ - /* There are two .rotate divs - one for each half of the background */ - position:absolute; - width:200px; - height:200px; - top:0; - left:0; -} - -.rotate.right{ - display:none; - z-index:11; -} - -.clock .bg, .clock .front{ - width:100px; - height:200px; - /*background-color:#252525;*/ - position:absolute; - top:0; -} - -.clock .display{ - /* Holds the number of seconds, minutes or hours respectfully */ - position:absolute; - width:200px; - font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif; - z-index:20; - color:#F5F5F5; - font-size:60px; - text-align:center; - top:65px; - left:0; - - /* CSS3 text shadow: */ - text-shadow:4px 4px 5px #333333; -} - -/* The left part of the background: */ - -.clock .bg.left{ left:0; } - -/* Individual styles for each color: */ -.orange .bg.left{ background:url(bg_orange.png) no-repeat left top; } -.green .bg.left{ background:url(bg_green.png) no-repeat left top; } -.blue .bg.left{ background:url(bg_blue.png) no-repeat left top; } - -/* The right part of the background: */ -.clock .bg.right{ left:100px; } - -.orange .bg.right{ background:url(bg_orange.png) no-repeat right top; } -.green .bg.right{ background:url(bg_green.png) no-repeat right top; } -.blue .bg.right{ background:url(bg_blue.png) no-repeat right top; } - - -.clock .front.left{ - left:0; - z-index:10; -} diff --git a/public/desktop_widgets/4fa7817cc88514014d7c59c2/index.html.erb b/public/desktop_widgets/4fa7817cc88514014d7c59c2/index.html.erb deleted file mode 100644 index 9862a505..00000000 --- a/public/desktop_widgets/4fa7817cc88514014d7c59c2/index.html.erb +++ /dev/null @@ -1,45 +0,0 @@ - -
    -
    - sunny -
    - 29°C -
    -
    Sunny
    -
    -
    - weekly report -
    -
    Hsin-Chu
    - > Weekly Report -
    - \ No newline at end of file diff --git a/public/desktop_widgets/4fa7818cc88514014d7c59c3/index.html.erb b/public/desktop_widgets/4fa7818cc88514014d7c59c3/index.html similarity index 100% rename from public/desktop_widgets/4fa7818cc88514014d7c59c3/index.html.erb rename to public/desktop_widgets/4fa7818cc88514014d7c59c3/index.html diff --git a/public/desktop_widgets/4fa78153c88514014d7c59bf/4fa78153c88514014d7c59bf.js b/public/desktop_widgets/509091e6bd98eb0352000009/509091e6bd98eb0352000009.js similarity index 100% rename from public/desktop_widgets/4fa78153c88514014d7c59bf/4fa78153c88514014d7c59bf.js rename to public/desktop_widgets/509091e6bd98eb0352000009/509091e6bd98eb0352000009.js diff --git a/public/desktop_widgets/4fa78153c88514014d7c59bf/events.json b/public/desktop_widgets/509091e6bd98eb0352000009/events.json similarity index 100% rename from public/desktop_widgets/4fa78153c88514014d7c59bf/events.json rename to public/desktop_widgets/509091e6bd98eb0352000009/events.json diff --git a/public/desktop_widgets/4fa78153c88514014d7c59bf/index.html.erb b/public/desktop_widgets/509091e6bd98eb0352000009/index.html similarity index 100% rename from public/desktop_widgets/4fa78153c88514014d7c59bf/index.html.erb rename to public/desktop_widgets/509091e6bd98eb0352000009/index.html diff --git a/public/desktop_widgets/browser/default.css b/public/desktop_widgets/browser/default.css new file mode 100755 index 00000000..fe1e395e --- /dev/null +++ b/public/desktop_widgets/browser/default.css @@ -0,0 +1 @@ +/* No Css */ \ No newline at end of file diff --git a/public/desktop_widgets/4fba4bf36f4fea8095e389eb/4fba4bf36f4fea8095e389eb.js b/public/desktop_widgets/browser/javascripts/browser.js similarity index 100% rename from public/desktop_widgets/4fba4bf36f4fea8095e389eb/4fba4bf36f4fea8095e389eb.js rename to public/desktop_widgets/browser/javascripts/browser.js diff --git a/public/desktop_widgets/browser/settings.json b/public/desktop_widgets/browser/settings.json new file mode 100644 index 00000000..3ce3df02 --- /dev/null +++ b/public/desktop_widgets/browser/settings.json @@ -0,0 +1,6 @@ +{ + "author" : "Harry", + "name" : "Browser", + "shape" : "w2 h1", + "version" : "1.0" +} diff --git a/public/desktop_widgets/4fba4bf36f4fea8095e389eb/index.html.erb b/public/desktop_widgets/browser/widget.html similarity index 100% rename from public/desktop_widgets/4fba4bf36f4fea8095e389eb/index.html.erb rename to public/desktop_widgets/browser/widget.html diff --git a/public/desktop_widgets/4fa7810ac88514014d7c59bc/index.html.erb b/public/desktop_widgets/clock/default.css similarity index 86% rename from public/desktop_widgets/4fa7810ac88514014d7c59bc/index.html.erb rename to public/desktop_widgets/clock/default.css index 2a69e24c..24125313 100755 --- a/public/desktop_widgets/4fa7810ac88514014d7c59bc/index.html.erb +++ b/public/desktop_widgets/clock/default.css @@ -1,81 +1,74 @@ - - -
    - \ No newline at end of file +.clock{ + /* The .clock div. Created dynamically by jQuery */ + background-color:#111; + height:75px; + width:75px; + position:relative; + overflow:hidden; + float:left; +} + +.clock .rotate{ + /* There are two .rotate divs - one for each half of the background */ + position:absolute; + width:75px; + height:75px; + top:0; + left:0; +} + +.rotate.right{ + display:none; + z-index:9; +} + +.clock .bg, .clock .front{ + width:37.5px; + height:75px; + background-color:#111; + position:absolute; + top:0; +} + +.clock .display{ + /* Holds the number of seconds, minutes or hours respectfully */ + position:absolute; + width:75px; + font-family: Orbitron, sans-serif; + z-index:17; + color:#F5F5F5; + font-size:21px; + text-align:center; + top:27.5px; + left:0px; + +} + +/* The left part of the background: */ + +.clock .bg.left{ left:0px; } + +/* Individual styles for each color: */ +.orange .bg.left{ background:url(desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_orange.png) no-repeat left top; } +.green .bg.left{ background:url(desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_green.png) no-repeat left top; } +.blue .bg.left{ background:url(desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_blue.png) no-repeat left top; } + +/* The right part of the background: */ +.clock .bg.right{ left:37.5px; } + +.orange .bg.right{ background:url(desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_orange.png) no-repeat right top; } +.green .bg.right{ background:url(desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_green.png) no-repeat right top; } +.blue .bg.right{ background:url(desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_blue.png) no-repeat right top; } + + +.clock .front.left{ + left:0; + z-index:15; +} +#fancyClock { + position: absolute; + overflow: hidden; + top: 50%; + left: 50%; + margin: -36px 0 0 -114px; +} \ No newline at end of file diff --git a/public/desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_blue.png b/public/desktop_widgets/clock/images/bg_blue.png similarity index 100% rename from public/desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_blue.png rename to public/desktop_widgets/clock/images/bg_blue.png diff --git a/public/desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_green.png b/public/desktop_widgets/clock/images/bg_green.png similarity index 100% rename from public/desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_green.png rename to public/desktop_widgets/clock/images/bg_green.png diff --git a/public/desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_orange.png b/public/desktop_widgets/clock/images/bg_orange.png similarity index 100% rename from public/desktop_widgets/4fa7810ac88514014d7c59bc/img/bg_orange.png rename to public/desktop_widgets/clock/images/bg_orange.png diff --git a/public/desktop_widgets/4fa7810ac88514014d7c59bc/4fa7810ac88514014d7c59bc.js b/public/desktop_widgets/clock/javascripts/clock.js similarity index 100% rename from public/desktop_widgets/4fa7810ac88514014d7c59bc/4fa7810ac88514014d7c59bc.js rename to public/desktop_widgets/clock/javascripts/clock.js diff --git a/public/desktop_widgets/clock/settings.json b/public/desktop_widgets/clock/settings.json new file mode 100644 index 00000000..8aa41d20 --- /dev/null +++ b/public/desktop_widgets/clock/settings.json @@ -0,0 +1,7 @@ +{ + "author" : "Harry", + "name" : "Clock", + "shape" : "w2 h1", + "version" : "1.0" + +} diff --git a/public/desktop_widgets/clock/widget.html b/public/desktop_widgets/clock/widget.html new file mode 100755 index 00000000..aeb6a444 --- /dev/null +++ b/public/desktop_widgets/clock/widget.html @@ -0,0 +1,5 @@ + +
    + \ No newline at end of file diff --git a/public/desktop_widgets/4fa78140c88514014d7c59be/index.html.erb b/public/desktop_widgets/googlesearch/default.css old mode 100644 new mode 100755 similarity index 59% rename from public/desktop_widgets/4fa78140c88514014d7c59be/index.html.erb rename to public/desktop_widgets/googlesearch/default.css index 341b8d81..1aede945 --- a/public/desktop_widgets/4fa78140c88514014d7c59be/index.html.erb +++ b/public/desktop_widgets/googlesearch/default.css @@ -1,4 +1,3 @@ - -
    - -
    - \ No newline at end of file +} \ No newline at end of file diff --git a/public/desktop_widgets/4fa78140c88514014d7c59be/img/google_64.png b/public/desktop_widgets/googlesearch/images/google_64.png similarity index 100% rename from public/desktop_widgets/4fa78140c88514014d7c59be/img/google_64.png rename to public/desktop_widgets/googlesearch/images/google_64.png diff --git a/public/desktop_widgets/4fa78140c88514014d7c59be/4fa78140c88514014d7c59be.js b/public/desktop_widgets/googlesearch/javascripts/google.js similarity index 100% rename from public/desktop_widgets/4fa78140c88514014d7c59be/4fa78140c88514014d7c59be.js rename to public/desktop_widgets/googlesearch/javascripts/google.js diff --git a/public/desktop_widgets/googlesearch/settings.json b/public/desktop_widgets/googlesearch/settings.json new file mode 100644 index 00000000..ddb52727 --- /dev/null +++ b/public/desktop_widgets/googlesearch/settings.json @@ -0,0 +1,7 @@ +{ + "author" : "Eric", + "name" : "Google Search", + "shape" : "w2 h1", + "version" : "1.0" + +} diff --git a/public/desktop_widgets/googlesearch/widget.html b/public/desktop_widgets/googlesearch/widget.html new file mode 100644 index 00000000..df5c715b --- /dev/null +++ b/public/desktop_widgets/googlesearch/widget.html @@ -0,0 +1,13 @@ + +
    + +
    + \ No newline at end of file diff --git a/public/desktop_widgets/4fa78161c88514014d7c59c0/4fa78161c88514014d7c59c0.js b/public/desktop_widgets/timetable/4fa78161c88514014d7c59c0.js similarity index 100% rename from public/desktop_widgets/4fa78161c88514014d7c59c0/4fa78161c88514014d7c59c0.js rename to public/desktop_widgets/timetable/4fa78161c88514014d7c59c0.js diff --git a/public/desktop_widgets/4fa78161c88514014d7c59c0/index.html.erb b/public/desktop_widgets/timetable/index.html.erb similarity index 100% rename from public/desktop_widgets/4fa78161c88514014d7c59c0/index.html.erb rename to public/desktop_widgets/timetable/index.html.erb diff --git a/public/desktop_widgets/weather/default.css b/public/desktop_widgets/weather/default.css new file mode 100644 index 00000000..ef65207d --- /dev/null +++ b/public/desktop_widgets/weather/default.css @@ -0,0 +1,26 @@ +.g_weather { position: relative; height: 198px; } + .g_weather img { float: left; display: block; margin: 0; padding: 12px; } + .g_weather .gw_recent { + overflow: hidden; + height: 96%; + padding-top: 4%; + } + .g_weather .gw_weekly { display: none; } + .g_weather .gw_location { + position: absolute; + left: 0; + bottom: 0; + font-size: 15px; + line-height: 20px; + } + .g_weather .gw_condition_des { font-size: 22px; } + .g_weather .gw_temp { margin-top: 26px; } + .g_weather .gw_temp_num { font-size: 56px; } + .g_weather .gw_temp_unit { font-size: 26px; } + .g_weather .gw_forecast { + position: absolute; + right: 0; + bottom: 0; + font-size: 13px; + line-height: 20px; +} \ No newline at end of file diff --git a/public/desktop_widgets/4fa7817cc88514014d7c59c2/img/sunny.png b/public/desktop_widgets/weather/images/sunny.png similarity index 100% rename from public/desktop_widgets/4fa7817cc88514014d7c59c2/img/sunny.png rename to public/desktop_widgets/weather/images/sunny.png diff --git a/public/desktop_widgets/4fa7817cc88514014d7c59c2/4fa7817cc88514014d7c59c2.js b/public/desktop_widgets/weather/javascripts/weather.js similarity index 100% rename from public/desktop_widgets/4fa7817cc88514014d7c59c2/4fa7817cc88514014d7c59c2.js rename to public/desktop_widgets/weather/javascripts/weather.js diff --git a/public/desktop_widgets/weather/settings.json b/public/desktop_widgets/weather/settings.json new file mode 100644 index 00000000..67e5a378 --- /dev/null +++ b/public/desktop_widgets/weather/settings.json @@ -0,0 +1,7 @@ +{ + "author" : "Devin", + "name" : "Weather", + "shape" : "w2 h2", + "version" : "0.0" + +} diff --git a/public/desktop_widgets/weather/widget.html b/public/desktop_widgets/weather/widget.html new file mode 100644 index 00000000..8cc412f2 --- /dev/null +++ b/public/desktop_widgets/weather/widget.html @@ -0,0 +1,17 @@ +
    +
    + sunny +
    + 29°C +
    +
    Sunny
    +
    +
    + weekly report +
    +
    Hsin-Chu
    + > Weekly Report +
    + \ No newline at end of file diff --git a/public/desktop_widgets/4fa78197c88514014d7c59c4/4fa78197c88514014d7c59c4.js b/public/desktop_widgets/youtube/4fa78197c88514014d7c59c4.js similarity index 100% rename from public/desktop_widgets/4fa78197c88514014d7c59c4/4fa78197c88514014d7c59c4.js rename to public/desktop_widgets/youtube/4fa78197c88514014d7c59c4.js diff --git a/public/desktop_widgets/4fa78197c88514014d7c59c4/index.html.erb b/public/desktop_widgets/youtube/index.html similarity index 100% rename from public/desktop_widgets/4fa78197c88514014d7c59c4/index.html.erb rename to public/desktop_widgets/youtube/index.html diff --git a/spec/helpers/attribute_fields_helper_spec.rb b/spec/helpers/attribute_fields_helper_spec.rb new file mode 100644 index 00000000..84be036a --- /dev/null +++ b/spec/helpers/attribute_fields_helper_spec.rb @@ -0,0 +1,78 @@ +#encoding: UTF-8 +require 'spec_helper' + +describe AttributeFieldsHelper do + describe "#attribute_field" do + context "In the HTML,there should always be 'value' tag in it's name" + + before(:all) do + @user = User.where(email:'chris@rulingcom.com').first + end #end before + # binding.pry + LIST[:markups].each do |markup| + it "should have 'value' when it's #{markup[0]} (no locale)" do + title = "標題" + pre_set_markup_value = case markup[0] + when "select","checkbox","radio_button" + '{"1"=>{"en"=>"Male", "zh_tw"=>"男性"}, "2"=>{"en"=>"Female", "zh_tw"=>"女性"}, "3"=>{"en"=>"Not public", "zh_tw"=>"不公開"}}' + else + nil + end + + attribute_field=AttributeField.find_or_create_by(key:'Test',markup: markup[0],markup_value: pre_set_markup_value,:title=>title) + + html = attribute_field.block_helper(@user,1) + + nodes = Nokogiri::HTML.fragment(html).search('*[@func="input_unit"]') + + nodes.each do |input| + attri = input.attributes["name"] + attri = input.children().first.attributes["name"] if (markup[0] == 'checkbox' || markup[0] == 'radio_button' ) + attri.to_s.should match /user\[.*attribute_values\]\[\d*\]\[value\].*/ + # user[attribute_values][1][id] + # user[attribute_values][1][value][en] + end #end of input loop + end # end of it + end #end markups + + LIST[:markups].each do |markup| + if markup[1]["muti_lang_input_supprt"] + [true,false].each do |locale_sat| + title = locale_sat ? {"en"=>"Title", "zh_tw"=>"標題"} : "標題" + it "should have 'value' when it's #{markup[0]} for locale => #{locale_sat}" do + pre_set_markup_value = case markup[0] + when "select","checkbox","radio_button" + '{"1"=>{"en"=>"Male", "zh_tw"=>"男性"}, "2"=>{"en"=>"Female", "zh_tw"=>"女性"}, "3"=>{"en"=>"Not public", "zh_tw"=>"不公開"}}' + else + nil + end + if (markup[0] == "text_field" || markup[0] == "text_area") && (locale_sat == false) + # binding.pry + end + attribute_field=AttributeField.find_or_create_by(key:'Test',markup: markup[0],markup_value: pre_set_markup_value,:title=>title,:locale => locale_sat) + + html = attribute_field.block_helper(@user,1) + + # p html + nodes = Nokogiri::HTML.fragment(html).search('*[@func="input_unit"]') + nodes.each do |input| + input.attributes["name"].to_s.should match /user\[.*attribute_values\]\[\d*\]\[value\].*/ + # user[attribute_values][1][id] + # user[attribute_values][1][value][en] + end #end of input loop + nodes = Nokogiri::HTML.fragment(html).search('*[@func="field_label"]') + + nodes.each do |input| + # p input.to_s + # binding.pry if + + input.children.text.should match "標題" + end # end of field_label loop + end # end of it + end # end of T/F + end# end of if support + end #end markups + + + end +end \ No newline at end of file diff --git a/spec/models/app_auth_basic.rb b/spec/models/app_auth_basic.rb index 0f629119..0f8549b7 100644 --- a/spec/models/app_auth_basic.rb +++ b/spec/models/app_auth_basic.rb @@ -1,218 +1,218 @@ -require 'spec_helper' -require 'ruby-debug' +# require 'spec_helper' +# require 'ruby-debug' -describe AppAuth do +# describe AppAuth do - before do - User.all.destroy - Role.all.destroy - SubRole.all.destroy - AppAuth.all.destroy - ModuleApp.all.destroy +# before do +# User.all.destroy +# Role.all.destroy +# SubRole.all.destroy +# AppAuth.all.destroy +# ModuleApp.all.destroy - #Create some fixtures of Main Role - main_role_key = ["Stud","Teacher","Staff"] - @new_main_role_list = main_role_key.each do |role| - new_role = Role.new :key => role - new_role.save - end - #Create Some SubRoles - sub_role_key = ["graduated_school","undergraduated_school","TA","Senior"] - @new_main_role_list = sub_role_key.each do |role| - new_role = SubRole.new :key => role - new_role.save - end +# #Create some fixtures of Main Role +# main_role_key = ["Stud","Teacher","Staff"] +# @new_main_role_list = main_role_key.each do |role| +# new_role = Role.new :key => role +# new_role.save +# end +# #Create Some SubRoles +# sub_role_key = ["graduated_school","undergraduated_school","TA","Senior"] +# @new_main_role_list = sub_role_key.each do |role| +# new_role = SubRole.new :key => role +# new_role.save +# end - #Create some users of User - user_emails = ["a_good_ug_stud_1","a_good_ug_stud_2","a_bad_ug_stud","a_good_g_stud","a_bad_g_stud","a_teacher","a_staff"] - user_emails.each do |user_email| - email=user_email+"@rulingcom.com" - new_user = User.new :email=> email - new_user.save - end - #MRK = Member Role Key SRK=Sub Role Key - @stud_MRK = Role.first(conditions:{key:"Stud"}) - @teacher_MRK = Role.first(conditions:{key:"Teacher"}) - @staff_MRK = Role.first(conditions:{key:"Staff"}) +# #Create some users of User +# user_emails = ["a_good_ug_stud_1","a_good_ug_stud_2","a_bad_ug_stud","a_good_g_stud","a_bad_g_stud","a_teacher","a_staff"] +# user_emails.each do |user_email| +# email=user_email+"@rulingcom.com" +# new_user = User.new :email=> email +# new_user.save +# end +# #MRK = Member Role Key SRK=Sub Role Key +# @stud_MRK = Role.first(conditions:{key:"Stud"}) +# @teacher_MRK = Role.first(conditions:{key:"Teacher"}) +# @staff_MRK = Role.first(conditions:{key:"Staff"}) - @graduated_SRK = SubRole.first(conditions:{key:"graduated_school"}) - @under_graduated_SRK = SubRole.first(conditions:{key:"undergraduated_school"}) - @ta_SRK = SubRole.first(conditions:{key:"TA"}) - @senior_SRK = SubRole.first(conditions:{key:"Senior"}) +# @graduated_SRK = SubRole.first(conditions:{key:"graduated_school"}) +# @under_graduated_SRK = SubRole.first(conditions:{key:"undergraduated_school"}) +# @ta_SRK = SubRole.first(conditions:{key:"TA"}) +# @senior_SRK = SubRole.first(conditions:{key:"Senior"}) - @stud_MRK.sub_roles += [@graduated,@under_graduated,@ta] - @stud_MRK.save! +# @stud_MRK.sub_roles += [@graduated,@under_graduated,@ta] +# @stud_MRK.save! - @teacher_MRK.sub_roles = [@senior] - @teacher_MRK.save! +# @teacher_MRK.sub_roles = [@senior] +# @teacher_MRK.save! - @good_ug_stu_1 = User.first(conditions:{email:"a_good_ug_stud_1@rulingcom.com"}) - @good_ug_stu_2 = User.first(conditions:{email:"a_good_ug_stud_2@rulingcom.com"}) - @bad_ug_stu = User.first(conditions:{email:"a_bad_ug_stud@rulingcom.com"}) +# @good_ug_stu_1 = User.first(conditions:{email:"a_good_ug_stud_1@rulingcom.com"}) +# @good_ug_stu_2 = User.first(conditions:{email:"a_good_ug_stud_2@rulingcom.com"}) +# @bad_ug_stu = User.first(conditions:{email:"a_bad_ug_stud@rulingcom.com"}) - @good_g_stu = User.first(conditions:{email:"a_good_g_stud@rulingcom.com"}) - @bad_g_stu = User.first(conditions:{email:"a_bad_g_stud@rulingcom.com"}) - @teacher = User.first(conditions:{email:"a_teacher@rulingcom.com"}) - @staff = User.first(conditions:{email:"a_staff@rulingcom.com"}) +# @good_g_stu = User.first(conditions:{email:"a_good_g_stud@rulingcom.com"}) +# @bad_g_stu = User.first(conditions:{email:"a_bad_g_stud@rulingcom.com"}) +# @teacher = User.first(conditions:{email:"a_teacher@rulingcom.com"}) +# @staff = User.first(conditions:{email:"a_staff@rulingcom.com"}) - #setting Roles for users - @good_g_stu.role = @stud_MRK - @bad_g_stu.role = @stud_MRK - @good_ug_stu_1.role = @stud_MRK - @good_ug_stu_2.role = @stud_MRK - @bad_ug_stu.role = @stud_MRK +# #setting Roles for users +# @good_g_stu.role = @stud_MRK +# @bad_g_stu.role = @stud_MRK +# @good_ug_stu_1.role = @stud_MRK +# @good_ug_stu_2.role = @stud_MRK +# @bad_ug_stu.role = @stud_MRK - @good_g_stu.sub_roles = [@graduated_SRK,@ta_SRK] - @bad_g_stu.sub_roles << @graduated_SRK - @good_ug_stu_1.sub_roles << @under_graduated_SRK - @good_ug_stu_2.sub_roles << @under_graduated_SRK - @bad_ug_stu.sub_roles << @under_graduated_SRK +# @good_g_stu.sub_roles = [@graduated_SRK,@ta_SRK] +# @bad_g_stu.sub_roles << @graduated_SRK +# @good_ug_stu_1.sub_roles << @under_graduated_SRK +# @good_ug_stu_2.sub_roles << @under_graduated_SRK +# @bad_ug_stu.sub_roles << @under_graduated_SRK - @teacher.role = @teacher_MRK - @staff.role = @staff_MRK +# @teacher.role = @teacher_MRK +# @staff.role = @staff_MRK - @good_g_stu.save! - @bad_g_stu.save! - @good_ug_stu_1.save! - @good_ug_stu_2.save! - @bad_ug_stu.save! +# @good_g_stu.save! +# @bad_g_stu.save! +# @good_ug_stu_1.save! +# @good_ug_stu_2.save! +# @bad_ug_stu.save! - @teacher.save! - @staff.save! +# @teacher.save! +# @staff.save! - end - describe "Starting a ClassBulletin Auth for teacher , staff and ta" do - before do - @bulletin_app_auth = AppAuth.new() - #all teacher and staff has access right - @bulletin_app_auth.roles = [@teacher_MRK,@staff_MRK] - #all person with TA sub_role has access right - @bulletin_app_auth.sub_roles << @ta_SRK +# end +# describe "Starting a ClassBulletin Auth for teacher , staff and ta" do +# before do +# @bulletin_app_auth = AppAuth.new() +# #all teacher and staff has access right +# @bulletin_app_auth.roles = [@teacher_MRK,@staff_MRK] +# #all person with TA sub_role has access right +# @bulletin_app_auth.sub_roles << @ta_SRK - #a_bad_ug_stud add to block to bulletin_app_auth - #@bulletin_app_auth.blocked_users << @bad_ug_stu +# #a_bad_ug_stud add to block to bulletin_app_auth +# #@bulletin_app_auth.blocked_users << @bad_ug_stu - #all teacher has access right - # @bulletin_app_auth.roles << @teacher_MRK +# #all teacher has access right +# # @bulletin_app_auth.roles << @teacher_MRK - # @bulletin_app_auth.privilege_users << @staff - @bulletin_app_auth.save! - end - context "Should just initialize all obj that is needed" do +# # @bulletin_app_auth.privilege_users << @staff +# @bulletin_app_auth.save! +# end +# context "Should just initialize all obj that is needed" do - it "Testing @bulletin_app_auth init result" do - @bulletin_app_auth.roles.should have(2).item #teacher staff - @bulletin_app_auth.sub_roles.should have(1).item #ta - end +# it "Testing @bulletin_app_auth init result" do +# @bulletin_app_auth.roles.should have(2).item #teacher staff +# @bulletin_app_auth.sub_roles.should have(1).item #ta +# end - it "@bulletin_app_auth should have Roles: Staff , Teacher " do - key_ary = @bulletin_app_auth.roles.collect do |role| - role.key - end - key_ary.sort.should == ["Staff","Teacher"].sort - end +# it "@bulletin_app_auth should have Roles: Staff , Teacher " do +# key_ary = @bulletin_app_auth.roles.collect do |role| +# role.key +# end +# key_ary.sort.should == ["Staff","Teacher"].sort +# end - it "bulletin_app_auth should have 3 auth users" do - user_ary = [@teacher,@staff,@good_g_stu] - @bulletin_app_auth.auth_users.sort.should == user_ary.sort - check_user_has_app user_ary - end +# it "bulletin_app_auth should have 3 auth users" do +# user_ary = [@teacher,@staff,@good_g_stu] +# @bulletin_app_auth.auth_users.sort.should == user_ary.sort +# check_user_has_app user_ary +# end - it "Adding a undergraduate stud into app_auth by privilege list" do - user_ary = [@teacher,@staff,@good_g_stu,@good_ug_stu_1] - @bulletin_app_auth.add_user_to_privilege_list @good_ug_stu_1 - @bulletin_app_auth.auth_users.sort.should == user_ary.sort - check_user_has_app user_ary - end +# it "Adding a undergraduate stud into app_auth by privilege list" do +# user_ary = [@teacher,@staff,@good_g_stu,@good_ug_stu_1] +# @bulletin_app_auth.add_user_to_privilege_list @good_ug_stu_1 +# @bulletin_app_auth.auth_users.sort.should == user_ary.sort +# check_user_has_app user_ary +# end - it "Adding all graudated-stud into app_auth" do - user_ary = [@teacher,@staff,@good_g_stu,@bad_g_stu] - @bulletin_app_auth.add_sub_role @graduated_SRK - @bulletin_app_auth.auth_users.sort.should == user_ary.sort - check_user_has_app user_ary - end +# it "Adding all graudated-stud into app_auth" do +# user_ary = [@teacher,@staff,@good_g_stu,@bad_g_stu] +# @bulletin_app_auth.add_sub_role @graduated_SRK +# @bulletin_app_auth.auth_users.sort.should == user_ary.sort +# check_user_has_app user_ary +# end - it "Blocking bad-graduate student" do - user_ary =[@teacher,@staff,@good_g_stu] - @bulletin_app_auth.add_sub_role @graduated_SRK - @bulletin_app_auth.add_user_to_black_list @bad_g_stu - @bulletin_app_auth.auth_users_after_block_list.sort.should == user_ary.sort - check_user_has_app user_ary - end +# it "Blocking bad-graduate student" do +# user_ary =[@teacher,@staff,@good_g_stu] +# @bulletin_app_auth.add_sub_role @graduated_SRK +# @bulletin_app_auth.add_user_to_black_list @bad_g_stu +# @bulletin_app_auth.auth_users_after_block_list.sort.should == user_ary.sort +# check_user_has_app user_ary +# end - it "Removing all graudated-stud from app_auth" do - user_ary =[@teacher,@staff,@good_g_stu] - @bulletin_app_auth.add_sub_role @graduated_SRK - @bulletin_app_auth.remove_sub_role @graduated_SRK - @bulletin_app_auth.auth_users.sort.should == user_ary.sort - check_user_has_app user_ary - end +# it "Removing all graudated-stud from app_auth" do +# user_ary =[@teacher,@staff,@good_g_stu] +# @bulletin_app_auth.add_sub_role @graduated_SRK +# @bulletin_app_auth.remove_sub_role @graduated_SRK +# @bulletin_app_auth.auth_users.sort.should == user_ary.sort +# check_user_has_app user_ary +# end - # it "@bulletin_app_auth should have one Privialage user which is belongs to Staff" do - # p_user_ary = @bulletin_app_auth.privilege_users.collect do |p_user| - # p_user.roles.key - # end - # p_user_ary.should include("Staff") - # end +# # it "@bulletin_app_auth should have one Privialage user which is belongs to Staff" do +# # p_user_ary = @bulletin_app_auth.privilege_users.collect do |p_user| +# # p_user.roles.key +# # end +# # p_user_ary.should include("Staff") +# # end - # it "@bulletin_app_auth should have one student listed at blocklist" do - # @bad_stu = User.first(conditions:{email:"a_bad_g_stud@rulingcom.com"}) - # @bulletin_app_auth.blocked_users.should have(1).item - # @bulletin_app_auth.blocked_users.should include(@bad_stu) - # end +# # it "@bulletin_app_auth should have one student listed at blocklist" do +# # @bad_stu = User.first(conditions:{email:"a_bad_g_stud@rulingcom.com"}) +# # @bulletin_app_auth.blocked_users.should have(1).item +# # @bulletin_app_auth.blocked_users.should include(@bad_stu) +# # end - # it "[Development #1]-1.Authorizing roles: roles + blocklist" do - # @good_stu = User.first(conditions:{email:"a_good_g_stud@rulingcom.com"}) - # @teacher = User.first(conditions:{email:"a_teacher@rulingcom.com"}) - # @staff = User.first(conditions:{email:"a_staff@rulingcom.com"}) - # ary = [@good_stu,@teacher,@staff] - # @bulletin_app_auth.auth_users_after_block_list.should == ary - # end - # - # it "[Development #1]-2.Authorizing single users: list of users [new_user1~2]" do - # user_emails = ["new_user1","new_user2","new_user3","new_user4"] - # user_emails.each do |user_email| - # email=user_email+"@rulingcom.com" - # new_user = User.new :email=> email - # new_user.save - # end - # user1= User.first(conditions:{email:"new_user1@rulingcom.com"}) - # user2= User.first(conditions:{email:"new_user2@rulingcom.com"}) - # user3= User.first(conditions:{email:"new_user3@rulingcom.com"}) - # user4= User.first(conditions:{email:"new_user4@rulingcom.com"}) - # - # @bulletin_app_auth.privilege_users << user1 - # @bulletin_app_auth.privilege_users << user2 - # - # @bulletin_app_auth.auth_users_after_block_list.should include(user1,user2) - # @bulletin_app_auth.auth_users_after_block_list.should_not include(user3,user4) - # - # end - # - # it "[Development #1]-3.Authorizing roles and single users: roles + blocklist + list of users" do - # @bulletin_app_auth.auth_users.should have(7).item - # end - # - # it "[Development #1]-4.Authorizing all: blocklist" do - # @bad_stu = User.first(conditions:{email:"a_bad_g_stud@rulingcom.com"}) - # @new_bulletin_app_auth = (AppAuth.new :all => true) - # @new_bulletin_app_auth.blocked_users << @bad_stu - # - # @new_bulletin_app_auth.auth_users.should == User.all.entries - # @new_bulletin_app_auth.auth_users_after_block_list.should_not include(@bad_stu) - # @new_bulletin_app_auth.save! - # end - def check_user_has_app(user_ary) - user_ary.each do |user| - user.avb_apps.should include(@bulletin_app_auth) - end - end - end +# # it "[Development #1]-1.Authorizing roles: roles + blocklist" do +# # @good_stu = User.first(conditions:{email:"a_good_g_stud@rulingcom.com"}) +# # @teacher = User.first(conditions:{email:"a_teacher@rulingcom.com"}) +# # @staff = User.first(conditions:{email:"a_staff@rulingcom.com"}) +# # ary = [@good_stu,@teacher,@staff] +# # @bulletin_app_auth.auth_users_after_block_list.should == ary +# # end +# # +# # it "[Development #1]-2.Authorizing single users: list of users [new_user1~2]" do +# # user_emails = ["new_user1","new_user2","new_user3","new_user4"] +# # user_emails.each do |user_email| +# # email=user_email+"@rulingcom.com" +# # new_user = User.new :email=> email +# # new_user.save +# # end +# # user1= User.first(conditions:{email:"new_user1@rulingcom.com"}) +# # user2= User.first(conditions:{email:"new_user2@rulingcom.com"}) +# # user3= User.first(conditions:{email:"new_user3@rulingcom.com"}) +# # user4= User.first(conditions:{email:"new_user4@rulingcom.com"}) +# # +# # @bulletin_app_auth.privilege_users << user1 +# # @bulletin_app_auth.privilege_users << user2 +# # +# # @bulletin_app_auth.auth_users_after_block_list.should include(user1,user2) +# # @bulletin_app_auth.auth_users_after_block_list.should_not include(user3,user4) +# # +# # end +# # +# # it "[Development #1]-3.Authorizing roles and single users: roles + blocklist + list of users" do +# # @bulletin_app_auth.auth_users.should have(7).item +# # end +# # +# # it "[Development #1]-4.Authorizing all: blocklist" do +# # @bad_stu = User.first(conditions:{email:"a_bad_g_stud@rulingcom.com"}) +# # @new_bulletin_app_auth = (AppAuth.new :all => true) +# # @new_bulletin_app_auth.blocked_users << @bad_stu +# # +# # @new_bulletin_app_auth.auth_users.should == User.all.entries +# # @new_bulletin_app_auth.auth_users_after_block_list.should_not include(@bad_stu) +# # @new_bulletin_app_auth.save! +# # end +# def check_user_has_app(user_ary) +# user_ary.each do |user| +# user.avb_apps.should include(@bulletin_app_auth) +# end +# end +# end - end +# end -end \ No newline at end of file +# end \ No newline at end of file diff --git a/spec/models/app_auth_spec.rb b/spec/models/app_auth_spec.rb index 7353f29d..4080250a 100644 --- a/spec/models/app_auth_spec.rb +++ b/spec/models/app_auth_spec.rb @@ -1,81 +1,81 @@ -require 'spec_helper' -require 'ruby-debug' +# require 'spec_helper' +# require 'ruby-debug' -describe AppAuth do +# describe AppAuth do - before(:all) do - @app_ary = [ - {"name" => "G_app_1" , "all" => false,"blockusers" => ["a_bad_stud@rulingcom.com"]}, - {"name" => "G_app_2" , "all" => true,"blockusers" => ["a_bad_stud@rulingcom.com"]}, - {"name" => "G_app_3_for_bad" , "all" => true,"blockusers" => []} - ] +# before(:all) do +# @app_ary = [ +# {"name" => "G_app_1" , "all" => false,"blockusers" => ["a_bad_stud@rulingcom.com"]}, +# {"name" => "G_app_2" , "all" => true,"blockusers" => ["a_bad_stud@rulingcom.com"]}, +# {"name" => "G_app_3_for_bad" , "all" => true,"blockusers" => []} +# ] - @app_ary.each do |t| - a = ModuleApp.new :title => t["name"] - blocked_users = t["blockusers"].collect do |b_user| - User.first(conditions:{email:b_user}) - end - a.create_app_auth :all=> t["all"],:blocked_users => blocked_users - a.save! - end - @good_stud_become_bad = User.first(conditions:{email:"a_good_stud@rulingcom.com"}) - @bad_stud_become_good = User.first(conditions:{email:"a_bad_stud@rulingcom.com"}) - @g_app_1 = ModuleApp.first(conditions:{title:"G_app_1"}) - @g_app_2 = ModuleApp.first(conditions:{title:"G_app_2"}) - @g_app_3 = ModuleApp.first(conditions:{title:"G_app_3_for_bad"}) - end +# @app_ary.each do |t| +# a = ModuleApp.new :title => t["name"] +# blocked_users = t["blockusers"].collect do |b_user| +# User.first(conditions:{email:b_user}) +# end +# a.create_app_auth :all=> t["all"],:blocked_users => blocked_users +# a.save! +# end +# @good_stud_become_bad = User.first(conditions:{email:"a_good_stud@rulingcom.com"}) +# @bad_stud_become_good = User.first(conditions:{email:"a_bad_stud@rulingcom.com"}) +# @g_app_1 = ModuleApp.first(conditions:{title:"G_app_1"}) +# @g_app_2 = ModuleApp.first(conditions:{title:"G_app_2"}) +# @g_app_3 = ModuleApp.first(conditions:{title:"G_app_3_for_bad"}) +# end - describe "[Init status check]" do - it "bad_stud_become_good status " do - @bad_stud_become_good.avb_apps.should_not include @g_app_1.app_auth - @bad_stud_become_good.avb_apps.should_not include @g_app_2.app_auth - @bad_stud_become_good.avb_apps.should include @g_app_3.app_auth - end +# describe "[Init status check]" do +# it "bad_stud_become_good status " do +# @bad_stud_become_good.avb_apps.should_not include @g_app_1.app_auth +# @bad_stud_become_good.avb_apps.should_not include @g_app_2.app_auth +# @bad_stud_become_good.avb_apps.should include @g_app_3.app_auth +# end - it "good_stud_become_bad status " do - @good_stud_become_bad.avb_apps.should_not include @g_app_1.app_auth - @good_stud_become_bad.avb_apps.should include @g_app_2.app_auth - @good_stud_become_bad.avb_apps.should include @g_app_3.app_auth - end - end +# it "good_stud_become_bad status " do +# @good_stud_become_bad.avb_apps.should_not include @g_app_1.app_auth +# @good_stud_become_bad.avb_apps.should include @g_app_2.app_auth +# @good_stud_become_bad.avb_apps.should include @g_app_3.app_auth +# end +# end - describe ".add_user_to_black_list sutd" do - it "When good stud is blocked with app1 and app2" do - @g_app_1.app_auth.add_user_to_black_list @good_stud_become_bad - @g_app_2.app_auth.add_user_to_black_list @good_stud_become_bad - @good_stud_become_bad.avb_apps.should_not include @g_app_1.app_auth - @good_stud_become_bad.avb_apps.should_not include @g_app_2.app_auth - end - end +# describe ".add_user_to_black_list sutd" do +# it "When good stud is blocked with app1 and app2" do +# @g_app_1.app_auth.add_user_to_black_list @good_stud_become_bad +# @g_app_2.app_auth.add_user_to_black_list @good_stud_become_bad +# @good_stud_become_bad.avb_apps.should_not include @g_app_1.app_auth +# @good_stud_become_bad.avb_apps.should_not include @g_app_2.app_auth +# end +# end - describe ".remove_user_from_black_list sutd" do - it "When bad stud is authed with app1 and app2" do - @g_app_1.app_auth.remove_user_from_black_list @bad_stud_become_good - @g_app_2.app_auth.remove_user_from_black_list @bad_stud_become_good - #@bad_stud_become_good.avb_apps.should include @g_app_1.app_auth - @bad_stud_become_good.avb_apps.should include @g_app_2.app_auth - end - end +# describe ".remove_user_from_black_list sutd" do +# it "When bad stud is authed with app1 and app2" do +# @g_app_1.app_auth.remove_user_from_black_list @bad_stud_become_good +# @g_app_2.app_auth.remove_user_from_black_list @bad_stud_become_good +# #@bad_stud_become_good.avb_apps.should include @g_app_1.app_auth +# @bad_stud_become_good.avb_apps.should include @g_app_2.app_auth +# end +# end - describe ".add_user_to_privilege_list sutd" do - it "When bad stud is auth for one more app" do - @bad_stud_become_good.avb_apps.should_not include @g_app_1.app_auth #shouldn't have at first time since app1 is not sat for all - @g_app_1.app_auth.add_user_to_privilege_list @bad_stud_become_good #change status - @bad_stud_become_good.avb_apps.should include @g_app_1.app_auth #check - end - end +# describe ".add_user_to_privilege_list sutd" do +# it "When bad stud is auth for one more app" do +# @bad_stud_become_good.avb_apps.should_not include @g_app_1.app_auth #shouldn't have at first time since app1 is not sat for all +# @g_app_1.app_auth.add_user_to_privilege_list @bad_stud_become_good #change status +# @bad_stud_become_good.avb_apps.should include @g_app_1.app_auth #check +# end +# end - describe ".remove_user_from_privilege_list sutd" do - it "admin mistake. remove user from privilege list" do - @g_app_1.app_auth.remove_user_from_privilege_list @bad_stud_become_good - @bad_stud_become_good.avb_apps.should_not include @g_app_1.app_auth - end - end +# describe ".remove_user_from_privilege_list sutd" do +# it "admin mistake. remove user from privilege list" do +# @g_app_1.app_auth.remove_user_from_privilege_list @bad_stud_become_good +# @bad_stud_become_good.avb_apps.should_not include @g_app_1.app_auth +# end +# end - after(:all) do - @app_ary.each do |item| - ModuleApp.first(conditions: {title: item["name"]}).destroy - end - end +# after(:all) do +# @app_ary.each do |item| +# ModuleApp.first(conditions: {title: item["name"]}).destroy +# end +# end -end \ No newline at end of file +# end \ No newline at end of file diff --git a/spec/models/attribute_field_spec.rb b/spec/models/attribute_field_spec.rb new file mode 100644 index 00000000..6fb01ba8 --- /dev/null +++ b/spec/models/attribute_field_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' +describe AttributeField do + describe "#list field" do + context "when field is in type text_field(without add more)" do + before(:each) do + @attribute_field = AttributeField.new(:key=>'test',:markup=>"text_field") + + + end + end + end +end \ No newline at end of file diff --git a/spec/models/attribute_value_spec.rb b/spec/models/attribute_value_spec.rb new file mode 100644 index 00000000..a9a741db --- /dev/null +++ b/spec/models/attribute_value_spec.rb @@ -0,0 +1,63 @@ +#encoding: UTF-8 +require 'spec_helper' + +describe AttributeValue do + describe "#attribute_value" do + context "Data should be able to input and out put as aspect" + + before do + @af = AttributeField.find '5052cf9f2b5c49a742000005' + @user = User.where(email:'chris@rulingcom.com').first + @av = AttributeValue.last + end #end before + + [true,false].each do |locale_sat| + LIST[:markups].each do |markup| + @av = nil + it "[#{markup[0]}]Input: should save data at right way when local is set to #{locale_sat}" do + @af.markup = markup[0] + @av = nil + @input_value = assume_result = case markup[0] + when 'text_field','text_area' + (locale_sat ? {"en"=> "lalala","zh_tw"=>"拉拉拉"} : "hahaha") + when 'select','radio_button' + "1" + when 'date' + {"(1i)"=>Date.today.year.to_s,"(2i)"=>Date.today.month.to_s,"(3i)"=>Date.today.day.to_s} + when 'checkbox' + {"1"=>"true", "3"=>"true"} + end #end of case + assume_result = ["1","3"] if markup[0] == 'checkbox' + @af.locale = locale_sat + @af.save + @data_hash = {"attribute_field_id" => @af.id,"value" => @input_value} + @av = @user.attribute_values.build(@data_hash) + @av.save + + @av.value.should == assume_result + # @av.destroy + end + + it "[#{markup[0]}]Output(just for show): should output data at right way when local is set to #{locale_sat}" do + locale = I18n.locale + assume_result = case markup[0] + when 'text_area' + (locale_sat ? "拉拉拉" : "hahaha") + when 'text_field' + (locale_sat ? "拉拉拉" : "hahaha") + when 'select','radio_button' + (locale_sat ? "男性" : "男性") + when 'date' + Date.today + when 'checkbox' + (locale_sat ? "男性,不公開" : "男性,不公開") + end #end of case + + @av.get_value_by_locale(locale).should == assume_result + end + + end #end of LIST loop + end + + end +end \ No newline at end of file diff --git a/spec/models/role_spec.rb b/spec/models/role_spec.rb index a58799b4..0d8d2fe9 100644 --- a/spec/models/role_spec.rb +++ b/spec/models/role_spec.rb @@ -1,113 +1,113 @@ -require 'spec_helper' + # require 'spec_helper' -describe Role do - before do - @role = Role.create(:key => 'teacher', - :i18n_variable => {:key => 'teacher', :en => 'Teacher', :zh_tw => 'Teacher in Chinese', :document_class => 'Role'}, - :sub_roles => [{:key => 'undergrad', - :i18n_variable => {:key => 'yeah', :en => 'Yeah', :zh_tw => 'Yeah', :document_class => 'Role'}, - :attribute_fields => [{:key => 'department'}, - {:key => 'room'}]}, - {:key => 'master', - :attribute_fields => [{:key => 'department'}]}]) - end - describe 'New role' do - describe '#Role' do - it 'should have :built_in false' do - @role.built_in.should be false - end - it 'should have :disabled false' do - @role.disabled.should be false - end - it 'should have a i18n_variable' do - @role.i18n_variable.should be_an_instance_of I18nVariable - end - it 'should create sub_roles' do - @role.should have(2).sub_roles - end - it 'should create attribute_fields' do - @role.sub_roles[1].should have(1).attribute_fields - end - end - describe '#SubRole' do - it 'should have :built_in false' do - @role.sub_roles[0].built_in.should be false - end - it 'should have :disabled false' do - @role.sub_roles[0].disabled.should be false - end - it 'should have a i18n_variable' do - @role.sub_roles[0].i18n_variable.should be_an_instance_of I18nVariable - end - end - describe '#AttributeField' do - it 'should have :built_in false' do - @role.sub_roles[0].attribute_fields[0].built_in.should be false - end - it 'should have :disabled false' do - @role.sub_roles[0].attribute_fields[0].disabled.should be false - end - end - end - describe 'Edit role' do - describe '#Role' do - before do - @role.update_attributes({:key => 'student', :i18n_variable => {:en => 'Student'}, - :sub_roles => [{:key => 'new', - :attribute_fields => [{:key => 'bob'}, - {:key => 'great'}]}, - {:id => @role.sub_roles[0].id}, - {:id => @role.sub_roles[1].id}]}) - end - it 'should not be the old :key' do - @role.key.should_not == 'teacher' - end - it 'should be the new :key' do - @role.key.should == 'student' - end - it 'should not be the old :i18n_variable[:en]' do - @role.i18n_variable[:en].should_not == 'Teacher' - end - it 'should be the new :i18n_variable[:en]' do - @role.i18n_variable[:en].should == 'Student' - end - it 'should have one more SubRole' do - @role.should have(3).sub_roles - end - end - end - describe 'Destroy' do - describe '#AttributeField' do - before do - @role.update_attributes(:key => 'teacher', - :i18n_variable => {:key => 'teacher', :en => 'Teacher', :zh_tw => 'Teacher in Chinese', :document_class => 'Role'}, - :sub_roles_attributes => {'0' => {:id => @role.sub_roles[0].id, - :key => 'undergrad', - :attribute_fields_attributes => {'0' => {:id => @role.sub_roles[0].attribute_fields[0].id, - :key => 'department'}, - '1' => {:id => @role.sub_roles[0].attribute_fields[1].id, - :key => 'room', :_destroy => true}}}}) - end - it 'should have only one AttributeField for the first SubRole' do - @role.sub_roles[0].should have(1).attribute_fields - end - end - describe '#I18nVariable' do - before do - @role.update_attributes(:key => 'teacher', - :i18n_variable_attributes => {:id => @role.i18n_variable.id, :key => 'teacher', :en => 'Teacher', :zh_tw => 'Teacher in Chinese', :document_class => 'Role', :_destroy => true}) - end - it 'should not have a I18nVariable' do - @role.i18n_variable.should_not be_an_instance_of I18nVariable - end - end - describe '#Role' do - it 'should destroy the I18nVariable' do - id = @role.i18n_variable.id - @role.destroy - lambda {I18nVariable.find(id)}.should raise_error - end - end - end +# describe Role do +# before do +# @role = Role.create(:key => 'teacher', +# :i18n_variable => {:key => 'teacher', :en => 'Teacher', :zh_tw => 'Teacher in Chinese', :document_class => 'Role'}, +# :sub_roles => [{:key => 'undergrad', +# :i18n_variable => {:key => 'yeah', :en => 'Yeah', :zh_tw => 'Yeah', :document_class => 'Role'}, +# :attribute_fields => [{:key => 'department'}, +# {:key => 'room'}]}, +# {:key => 'master', +# :attribute_fields => [{:key => 'department'}]}]) +# end +# describe 'New role' do +# describe '#Role' do +# it 'should have :built_in false' do +# @role.built_in.should be false +# end +# it 'should have :disabled false' do +# @role.disabled.should be false +# end +# it 'should have a i18n_variable' do +# @role.i18n_variable.should be_an_instance_of I18nVariable +# end +# it 'should create sub_roles' do +# @role.should have(2).sub_roles +# end +# it 'should create attribute_fields' do +# @role.sub_roles[1].should have(1).attribute_fields +# end +# end +# describe '#SubRole' do +# it 'should have :built_in false' do +# @role.sub_roles[0].built_in.should be false +# end +# it 'should have :disabled false' do +# @role.sub_roles[0].disabled.should be false +# end +# it 'should have a i18n_variable' do +# @role.sub_roles[0].i18n_variable.should be_an_instance_of I18nVariable +# end +# end +# describe '#AttributeField' do +# it 'should have :built_in false' do +# @role.sub_roles[0].attribute_fields[0].built_in.should be false +# end +# it 'should have :disabled false' do +# @role.sub_roles[0].attribute_fields[0].disabled.should be false +# end +# end +# end +# describe 'Edit role' do +# describe '#Role' do +# before do +# @role.update_attributes({:key => 'student', :i18n_variable => {:en => 'Student'}, +# :sub_roles => [{:key => 'new', +# :attribute_fields => [{:key => 'bob'}, +# {:key => 'great'}]}, +# {:id => @role.sub_roles[0].id}, +# {:id => @role.sub_roles[1].id}]}) +# end +# it 'should not be the old :key' do +# @role.key.should_not == 'teacher' +# end +# it 'should be the new :key' do +# @role.key.should == 'student' +# end +# it 'should not be the old :i18n_variable[:en]' do +# @role.i18n_variable[:en].should_not == 'Teacher' +# end +# it 'should be the new :i18n_variable[:en]' do +# @role.i18n_variable[:en].should == 'Student' +# end +# it 'should have one more SubRole' do +# @role.should have(3).sub_roles +# end +# end +# end +# describe 'Destroy' do +# describe '#AttributeField' do +# before do +# @role.update_attributes(:key => 'teacher', +# :i18n_variable => {:key => 'teacher', :en => 'Teacher', :zh_tw => 'Teacher in Chinese', :document_class => 'Role'}, +# :sub_roles_attributes => {'0' => {:id => @role.sub_roles[0].id, +# :key => 'undergrad', +# :attribute_fields_attributes => {'0' => {:id => @role.sub_roles[0].attribute_fields[0].id, +# :key => 'department'}, +# '1' => {:id => @role.sub_roles[0].attribute_fields[1].id, +# :key => 'room', :_destroy => true}}}}) +# end +# it 'should have only one AttributeField for the first SubRole' do +# @role.sub_roles[0].should have(1).attribute_fields +# end +# end +# describe '#I18nVariable' do +# before do +# @role.update_attributes(:key => 'teacher', +# :i18n_variable_attributes => {:id => @role.i18n_variable.id, :key => 'teacher', :en => 'Teacher', :zh_tw => 'Teacher in Chinese', :document_class => 'Role', :_destroy => true}) +# end +# it 'should not have a I18nVariable' do +# @role.i18n_variable.should_not be_an_instance_of I18nVariable +# end +# end +# describe '#Role' do +# it 'should destroy the I18nVariable' do +# id = @role.i18n_variable.id +# @role.destroy +# lambda {I18nVariable.find(id)}.should raise_error +# end +# end +# end -end \ No newline at end of file +# end \ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2529da0f..cd0b93ad 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -38,6 +38,7 @@ Spork.prefork do # automatically. This will be the default behavior in future versions of # rspec-rails. config.infer_base_class_for_anonymous_controllers = false + end end 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 7e36a22d..31e08fb4 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 @@ -49,4 +49,4 @@ module Panel::Announcement::BackEnd::BulletinsHelper end -end \ No newline at end of file +end diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/plugin/_profile.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/plugin/_profile.html.erb index 54b2428e..2cb15a65 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/plugin/_profile.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/plugin/_profile.html.erb @@ -1 +1,53 @@ -Hello~ I am your plugin profile \ No newline at end of file +<% + if @user + @bulletins = Bulletin.where(:create_user_id => @user.id).page(params[:page]).per(10) + else + @bulletins = Bulletin.all.page(params[:page]).per(10) + end + +%> + + + + + + + + + + <% if not @user%> + + <% end %> + + + + <% @bulletins.each do |bulletin| %> + + + + + <% if not bulletin.deadline.nil?%> + + <%else%> + + <% end %> + + <% if not @user%> + + <% end %> + + <% end %> + +
    <%= t('bulletin.category') %><%= t('bulletin.title') %><%= t('bulletin.start_date') %><%= t('bulletin.end_date') %><%= t('bulletin.tags') %><%= t('bulletin.last_modified') %>
    <%= bulletin.bulletin_category.title%> + <% if bulletin.is_checked? %> + <%= link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%> + <% else %> + <%= bulletin.title%> + <% end %> + <%= display_date_time(bulletin.postdate) %><%= display_date_time(bulletin.deadline) %><%= t('bulletin.no_deadline') %> +
    + <% bulletin.sorted_tags.each do |tag| %> + <%= tag[I18n.locale] %> + <% end %> +
    +
    <%= User.find(bulletin.create_user_id).name %>
    diff --git a/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb index f9aba371..beed6b8a 100644 --- a/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb @@ -37,7 +37,6 @@ class Panel::Archive::BackEnd::ArchiveFileCategorysController < OrbitBackendCont # GET /archive_files/1/edit def edit @archive_file_category = ArchiveFileCategory.find(params[:id]) - @i18n_variable = @archive_file_category.i18n_variable @url = panel_archive_back_end_archive_file_category_path(@archive_file_category) diff --git a/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_files_controller.rb b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_files_controller.rb index a4804bb5..0336c11b 100644 --- a/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_files_controller.rb +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_files_controller.rb @@ -55,7 +55,6 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController # POST /archive_files.xml def create @archive_file = ArchiveFile.new(params[:archive_file]) - @archive_file.create_user_id = current_user.id @archive_file.update_user_id = current_user.id @@ -64,6 +63,8 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController format.html { redirect_to(panel_archive_back_end_archive_files_url) } format.xml { render :xml => @archive_file, :status => :created, :location => @archive_file } else + get_categorys + get_tags format.html { render :action => "new" } format.xml { render :xml => @archive_file.errors, :status => :unprocessable_entity } end diff --git a/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb b/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb index 594b7348..a436f5a9 100644 --- a/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/front_end/archive_files_controller.rb @@ -9,7 +9,7 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController @item = Page.find(params[:page_id]) - @title = @item.i18n_variable[I18n.locale] + @title = @item.title if @item.frontend_data_count @page_num = @item.frontend_data_count @@ -41,7 +41,7 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController @item = Page.find(params[:page_id]) - @title = @item.i18n_variable[I18n.locale] + @title = @item.title @archive_file = ArchiveFile.find(params[:id]) @@ -55,7 +55,7 @@ class Panel::Archive::FrontEnd::ArchiveFilesController < OrbitWidgetController @item = Page.find(params[:page_id]) - @title = @item.i18n_variable[I18n.locale] + @title = @item.title if @item.frontend_data_count @page_num = @item.frontend_data_count diff --git a/vendor/built_in_modules/archive/app/models/archive_file.rb b/vendor/built_in_modules/archive/app/models/archive_file.rb index 9cf2eedd..2d53e7ff 100644 --- a/vendor/built_in_modules/archive/app/models/archive_file.rb +++ b/vendor/built_in_modules/archive/app/models/archive_file.rb @@ -26,7 +26,7 @@ class ArchiveFile accepts_nested_attributes_for :archive_file_multiples, :allow_destroy => true - validates_presence_of :title + validates :title, :at_least_one => true after_save :save_archive_file_multiples diff --git a/vendor/built_in_modules/archive/app/models/archive_file_category.rb b/vendor/built_in_modules/archive/app/models/archive_file_category.rb index abb08bd3..f3d2fcd9 100644 --- a/vendor/built_in_modules/archive/app/models/archive_file_category.rb +++ b/vendor/built_in_modules/archive/app/models/archive_file_category.rb @@ -7,8 +7,10 @@ class ArchiveFileCategory field :key - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + field :title, localize: true has_many :archive_files + + validates :title, :at_least_one => true end \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/models/archive_file_multiple.rb b/vendor/built_in_modules/archive/app/models/archive_file_multiple.rb index 0ac3070b..9dc83363 100644 --- a/vendor/built_in_modules/archive/app/models/archive_file_multiple.rb +++ b/vendor/built_in_modules/archive/app/models/archive_file_multiple.rb @@ -9,8 +9,6 @@ class ArchiveFileMultiple # field :description field :choose_lang, :type => Array, :default => nil - # has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy - field :should_destroy, :type => Boolean def choose_lang_display(lang) diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb index c6bf4616..d8c5e8e1 100644 --- a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb @@ -11,6 +11,6 @@ <% @site_valid_locales.each do |locale| %> - <%= archive_file_category.i18n_variable[locale] rescue nil %> + <%= archive_file_category.title_translations[locale] rescue nil %> <% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_form.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_form.html.erb index f79bbab0..345390df 100644 --- a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_form.html.erb +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_form.html.erb @@ -10,12 +10,12 @@
    - <%= f.fields_for :i18n_variable, (@archive_file_category.new_record? ? @archive_file_category.build_i18n_variable : @archive_file_category.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
    - <%= f.text_field locale, :class => 'input-xxlarge' %> + <%= f.text_field locale, :class =>' input-xxlarge', :value => (@archive_file_category.title[locale] rescue nil) %>
    <% end %> diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_archive_files.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_archive_files.html.erb index 9f9ca8f9..7f540486 100644 --- a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_archive_files.html.erb +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_archive_files.html.erb @@ -17,7 +17,7 @@
    - <%= post.archive_file_category.i18n_variable[I18n.locale] %> + <%= post.archive_file_category.title %> <%= link_to post.title, panel_archive_front_end_archive_file_path(post) %> diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb index e6c93f1f..bd080e1e 100644 --- a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_files/_form.html.erb @@ -43,7 +43,7 @@
    <%= f.label :category %> - <%= f.select :archive_file_category_id, @archive_file_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %> + <%= f.select :archive_file_category_id, @archive_file_categorys.collect {|t| [ t.title, t.id ]} %>
    - - --> \ No newline at end of file + <% end %> + \ No newline at end of file diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/day_view.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/day_view.html.erb index 709437c7..2edd9e7c 100644 --- a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/day_view.html.erb +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/day_view.html.erb @@ -28,11 +28,13 @@
    <% @hours.each do |hour| %> -
    -
    +
    " ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="AM"> +
    -
    -
    + <% end %> + <% @hours.each do |hour| %> +
    " ref="add-btn" link="<%= new_panel_calendar_back_end_event_path %>" date="<%= @date.to_s %>" ses="PM"> +
    <% end %>
    diff --git a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb index 791cfe19..eea0e647 100644 --- a/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb +++ b/vendor/built_in_modules/calendar/app/views/panel/calendar/back_end/cals/index.html.erb @@ -1,10 +1,8 @@ <%= stylesheet_link_tag "font-awesome" %> -<%= stylesheet_link_tag "calendar" %> <%= stylesheet_link_tag "bootstrap-responsive" %> -<% content_for :page_specific_javascript do %> - <%= javascript_include_tag "calendarAPI" %> -<% end %> - +<%= stylesheet_link_tag "calendar" %> +<%= javascript_include_tag "cals" %> +