From e99fef9404a46673187c7c47a4794c7280acdaf7 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Mon, 4 Mar 2013 11:45:39 +0800 Subject: [PATCH 01/13] fixed paper title and journal title bug --- .../personal_journal/desktop/journal_pages/_form.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb index 4fd93991..161353fa 100644 --- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb +++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb @@ -33,7 +33,7 @@ class: "s_grid_6 s_grid", size: "20x2", placeholder: t("personal_journal.paper_title"), - value: (@writing_journal.paper_title_translations[locale] rescue nil) %> + value: (@writing_journal.paper_title_translations[locale.to_s] rescue nil) %> <% end %>
  • @@ -43,7 +43,7 @@ placeholder: t("personal_journal.journal_title"), class: "s_grid_6 s_grid", "autocomplete-list" => "journal_title_autocomplete_list", - value: (@writing_journal.journal_title_translations[locale] rescue nil) %> + value: (@writing_journal.journal_title_translations[locale.to_s] rescue nil) %> <% end %>
  • @@ -94,7 +94,7 @@ size: "20x2", placeholder: t("personal_journal.authors"), "autocomplete-list" => "coauthor_autocomplete_list", - value: (@writing_journal.authors_translations[locale] rescue nil) %> + value: (@writing_journal.authors_translations[locale.to_s] rescue nil) %> <% end %> From 8f1d7b55ab6b19c3956ae9b9e9c23fd15ae3e769 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Mon, 4 Mar 2013 12:16:46 +0800 Subject: [PATCH 02/13] authors auto-complete --- app/assets/javascripts/desktop.js | 1 + app/assets/javascripts/jquery.tokeninput.js | 1043 +++++++++++++++++ .../stylesheets/token-input-facebook.css | 122 ++ app/assets/stylesheets/token-input-mac.css | 204 ++++ app/assets/stylesheets/token-input.css | 127 ++ .../desktop/conference_pages_controller.rb | 16 +- .../desktop/conference_pages_helper.rb | 12 + .../app/models/conference_co_author.rb | 3 +- .../app/models/writing_conference.rb | 20 + .../desktop/conference_pages/_form.html.erb | 31 +- .../personal_conference/config/locales/en.yml | 3 + .../config/locales/zh_tw.yml | 3 + 12 files changed, 1576 insertions(+), 9 deletions(-) create mode 100644 app/assets/javascripts/jquery.tokeninput.js create mode 100644 app/assets/stylesheets/token-input-facebook.css create mode 100644 app/assets/stylesheets/token-input-mac.css create mode 100644 app/assets/stylesheets/token-input.css diff --git a/app/assets/javascripts/desktop.js b/app/assets/javascripts/desktop.js index c4f95055..c55534a4 100644 --- a/app/assets/javascripts/desktop.js +++ b/app/assets/javascripts/desktop.js @@ -16,3 +16,4 @@ //= require orbitdesktop //= require jquery.gridster //= require desktop/books_pages +//= require jquery.tokeninput diff --git a/app/assets/javascripts/jquery.tokeninput.js b/app/assets/javascripts/jquery.tokeninput.js new file mode 100644 index 00000000..830e982f --- /dev/null +++ b/app/assets/javascripts/jquery.tokeninput.js @@ -0,0 +1,1043 @@ +/* + * jQuery Plugin: Tokenizing Autocomplete Text Entry + * Version 1.6.1 + * + * Copyright (c) 2009 James Smith (http://loopj.com) + * Licensed jointly under the GPL and MIT licenses, + * choose which one suits your project best! + * + */ + +(function ($) { +// Default settings +var DEFAULT_SETTINGS = { + // Search settings + method: "GET", + queryParam: "q", + searchDelay: 300, + minChars: 1, + propertyToSearch: "name", + jsonContainer: null, + contentType: "json", + + // Prepopulation settings + prePopulate: null, + processPrePopulate: false, + + // Display settings + hintText: "Type in a search term", + noResultsText: "No results", + searchingText: "Searching...", + deleteText: "×", + animateDropdown: true, + placeholder: null, + theme: null, + zindex: 999, + resultsLimit: null, + + enableHTML: false, + + resultsFormatter: function(item) { + var string = item[this.propertyToSearch]; + return "
  • " + (this.enableHTML ? string : _escapeHTML(string)) + "
  • "; + }, + + tokenFormatter: function(item) { + var string = item[this.propertyToSearch]; + return "
  • " + (this.enableHTML ? string : _escapeHTML(string)) + "

  • "; + }, + + // Tokenization settings + tokenLimit: null, + tokenDelimiter: ",", + preventDuplicates: false, + tokenValue: "id", + + // Behavioral settings + allowFreeTagging: false, + allowTabOut: false, + + // Callbacks + onResult: null, + onCachedResult: null, + onAdd: null, + onFreeTaggingAdd: null, + onDelete: null, + onReady: null, + + // Other settings + idPrefix: "token-input-", + + // Keep track if the input is currently in disabled mode + disabled: false +}; + +// Default classes to use when theming +var DEFAULT_CLASSES = { + tokenList: "token-input-list", + token: "token-input-token", + tokenReadOnly: "token-input-token-readonly", + tokenDelete: "token-input-delete-token", + selectedToken: "token-input-selected-token", + highlightedToken: "token-input-highlighted-token", + dropdown: "token-input-dropdown", + dropdownItem: "token-input-dropdown-item", + dropdownItem2: "token-input-dropdown-item2", + selectedDropdownItem: "token-input-selected-dropdown-item", + inputToken: "token-input-input-token", + focused: "token-input-focused", + disabled: "token-input-disabled" +}; + +// Input box position "enum" +var POSITION = { + BEFORE: 0, + AFTER: 1, + END: 2 +}; + +// Keys "enum" +var KEY = { + BACKSPACE: 8, + TAB: 9, + ENTER: 13, + ESCAPE: 27, + SPACE: 32, + PAGE_UP: 33, + PAGE_DOWN: 34, + END: 35, + HOME: 36, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40, + NUMPAD_ENTER: 108, + COMMA: 188 +}; + +var HTML_ESCAPES = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/' +}; + +var HTML_ESCAPE_CHARS = /[&<>"'\/]/g; + +function coerceToString(val) { + return String((val === null || val === undefined) ? '' : val); +} + +function _escapeHTML(text) { + return coerceToString(text).replace(HTML_ESCAPE_CHARS, function(match) { + return HTML_ESCAPES[match]; + }); +} + +// Additional public (exposed) methods +var methods = { + init: function(url_or_data_or_function, options) { + var settings = $.extend({}, DEFAULT_SETTINGS, options || {}); + + return this.each(function () { + $(this).data("settings", settings); + $(this).data("tokenInputObject", new $.TokenList(this, url_or_data_or_function, settings)); + }); + }, + clear: function() { + this.data("tokenInputObject").clear(); + return this; + }, + add: function(item) { + this.data("tokenInputObject").add(item); + return this; + }, + remove: function(item) { + this.data("tokenInputObject").remove(item); + return this; + }, + get: function() { + return this.data("tokenInputObject").getTokens(); + }, + toggleDisabled: function(disable) { + this.data("tokenInputObject").toggleDisabled(disable); + return this; + }, + setOptions: function(options){ + $(this).data("settings", $.extend({}, $(this).data("settings"), options || {})); + return this; + } +}; + +// Expose the .tokenInput function to jQuery as a plugin +$.fn.tokenInput = function (method) { + // Method calling and initialization logic + if(methods[method]) { + return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); + } else { + return methods.init.apply(this, arguments); + } +}; + +// TokenList class for each input +$.TokenList = function (input, url_or_data, settings) { + // + // Initialization + // + + // Configure the data source + if($.type(url_or_data) === "string" || $.type(url_or_data) === "function") { + // Set the url to query against + $(input).data("settings").url = url_or_data; + + // If the URL is a function, evaluate it here to do our initalization work + var url = computeURL(); + + // Make a smart guess about cross-domain if it wasn't explicitly specified + if($(input).data("settings").crossDomain === undefined && typeof url === "string") { + if(url.indexOf("://") === -1) { + $(input).data("settings").crossDomain = false; + } else { + $(input).data("settings").crossDomain = (location.href.split(/\/+/g)[1] !== url.split(/\/+/g)[1]); + } + } + } else if(typeof(url_or_data) === "object") { + // Set the local data to search through + $(input).data("settings").local_data = url_or_data; + } + + // Build class names + if($(input).data("settings").classes) { + // Use custom class names + $(input).data("settings").classes = $.extend({}, DEFAULT_CLASSES, $(input).data("settings").classes); + } else if($(input).data("settings").theme) { + // Use theme-suffixed default class names + $(input).data("settings").classes = {}; + $.each(DEFAULT_CLASSES, function(key, value) { + $(input).data("settings").classes[key] = value + "-" + $(input).data("settings").theme; + }); + } else { + $(input).data("settings").classes = DEFAULT_CLASSES; + } + + + // Save the tokens + var saved_tokens = []; + + // Keep track of the number of tokens in the list + var token_count = 0; + + // Basic cache to save on db hits + var cache = new $.TokenList.Cache(); + + // Keep track of the timeout, old vals + var timeout; + var input_val; + + // Create a new text input an attach keyup events + var input_box = $("") + .css({ + outline: "none" + }) + .attr("id", $(input).data("settings").idPrefix + input.id) + .focus(function () { + if ($(input).data("settings").disabled) { + return false; + } else + if ($(input).data("settings").tokenLimit === null || $(input).data("settings").tokenLimit !== token_count) { + show_dropdown_hint(); + } + token_list.addClass($(input).data("settings").classes.focused); + }) + .blur(function () { + hide_dropdown(); + + if ($(input).data("settings").allowFreeTagging) { + add_freetagging_tokens(); + } + + $(this).val(""); + token_list.removeClass($(input).data("settings").classes.focused); + }) + .bind("keyup keydown blur update", resize_input) + .keydown(function (event) { + var previous_token; + var next_token; + + switch(event.keyCode) { + case KEY.LEFT: + case KEY.RIGHT: + case KEY.UP: + case KEY.DOWN: + if(!$(this).val()) { + previous_token = input_token.prev(); + next_token = input_token.next(); + + if((previous_token.length && previous_token.get(0) === selected_token) || (next_token.length && next_token.get(0) === selected_token)) { + // Check if there is a previous/next token and it is selected + if(event.keyCode === KEY.LEFT || event.keyCode === KEY.UP) { + deselect_token($(selected_token), POSITION.BEFORE); + } else { + deselect_token($(selected_token), POSITION.AFTER); + } + } else if((event.keyCode === KEY.LEFT || event.keyCode === KEY.UP) && previous_token.length) { + // We are moving left, select the previous token if it exists + select_token($(previous_token.get(0))); + } else if((event.keyCode === KEY.RIGHT || event.keyCode === KEY.DOWN) && next_token.length) { + // We are moving right, select the next token if it exists + select_token($(next_token.get(0))); + } + } else { + var dropdown_item = null; + + if(event.keyCode === KEY.DOWN || event.keyCode === KEY.RIGHT) { + dropdown_item = $(selected_dropdown_item).next(); + } else { + dropdown_item = $(selected_dropdown_item).prev(); + } + + if(dropdown_item.length) { + select_dropdown_item(dropdown_item); + } + } + return false; + break; + + case KEY.BACKSPACE: + previous_token = input_token.prev(); + + if(!$(this).val().length) { + if(selected_token) { + delete_token($(selected_token)); + hidden_input.change(); + } else if(previous_token.length) { + select_token($(previous_token.get(0))); + } + + return false; + } else if($(this).val().length === 1) { + hide_dropdown(); + } else { + // set a timeout just long enough to let this function finish. + setTimeout(function(){do_search();}, 5); + } + break; + + case KEY.TAB: + case KEY.ENTER: + case KEY.NUMPAD_ENTER: + case KEY.COMMA: + if(selected_dropdown_item) { + add_token($(selected_dropdown_item).data("tokeninput")); + hidden_input.change(); + } else { + if ($(input).data("settings").allowFreeTagging) { + if($(input).data("settings").allowTabOut && $(this).val() === "") { + return true; + } else { + add_freetagging_tokens(); + } + } else { + $(this).val(""); + if($(input).data("settings").allowTabOut) { + return true; + } + } + event.stopPropagation(); + event.preventDefault(); + } + return false; + + case KEY.ESCAPE: + hide_dropdown(); + return true; + + default: + if(String.fromCharCode(event.which)) { + // set a timeout just long enough to let this function finish. + setTimeout(function(){do_search();}, 5); + } + break; + } + }); + + // Keep reference for placeholder + if (settings.placeholder) + input_box.attr("placeholder", settings.placeholder) + + // Keep a reference to the original input box + var hidden_input = $(input) + .hide() + .val("") + .focus(function () { + focus_with_timeout(input_box); + }) + .blur(function () { + input_box.blur(); + }); + + // Keep a reference to the selected token and dropdown item + var selected_token = null; + var selected_token_index = 0; + var selected_dropdown_item = null; + + // The list to store the token items in + var token_list = $(" + -
    -
      -
    • - - - - - - - - - - - - - - - <% @writing_conference.writing_conference_files.each_with_index do |writing_conference_file, i| %> - <%= f.fields_for :writing_conference_files, writing_conference_file do |f| %> - <%= render :partial => 'form_file', :object => writing_conference_file, :locals => {:f => f, :i => i} %> +
      +
      +
        +
      • +
      <%= t("personal_conference.file")%><%= t("personal_conference.file_name")%><%= t("personal_conference.description") %>
      -
      - <%= hidden_field_tag 'plugin_file_field_count', @writing_conference.writing_conference_files.count %> - add -
      -
      + + + + + + + + + + + + + + <% @writing_conference.writing_conference_files.each_with_index do |writing_conference_file, i| %> + <%= f.fields_for :writing_conference_files, writing_conference_file do |f| %> + <%= render :partial => 'form_file', :object => writing_conference_file, :locals => {:f => f, :i => i} %> + <% end %> <% end %> - <% end %> - -
      <%= t("personal_conference.file")%><%= t("personal_conference.file_name")%><%= t("personal_conference.description") %>
      +
      + <%= hidden_field_tag 'plugin_file_field_count', @writing_conference.writing_conference_files.count %> + add +
      +
      -
    • -
    -
    -
  • -
      - <%= f.text_area :note, size: "20x22", placeholder: t("personal_conference.note"), class: "s_grid_6 s_grid full_height"%> -
    -
  • + + + +
    + +
    +
    +
  • +
      + <%= f.text_area :note, size: "20x22", placeholder: t("personal_conference.note"), class: "s_grid_6 s_grid full_height"%> +
    +
  • +
    +
    - -<%= stylesheet_link_tag "token-input-facebook" %> -<%= javascript_include_tag :defaults, "jquery.tokeninput" %> + <%= stylesheet_link_tag "token-input-facebook" %> + <%= javascript_include_tag :defaults, "jquery.tokeninput" %> - + - + - + diff --git a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/conference_type.html.erb b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/conference_type.html.erb index a4fd58b2..1793aff7 100644 --- a/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/conference_type.html.erb +++ b/vendor/built_in_modules/personal_conference/app/views/panel/personal_conference/desktop/conference_pages/conference_type.html.erb @@ -16,13 +16,11 @@
    -
    +
    <% @conference_lists.each_with_index do |conference_list,i| %> - <% if ( i % 5 ) == 0 %>
      - <% end %> -
    • +
    • @@ -30,10 +28,8 @@
      <%= title %>
      <%= level.join(",") %>
    • - <% if ( i % 5 ) == 4 %>
    - <% end %> <% end %>
    diff --git a/vendor/built_in_modules/personal_conference/config/locales/en.yml b/vendor/built_in_modules/personal_conference/config/locales/en.yml index 5fb77c18..d4cd006b 100644 --- a/vendor/built_in_modules/personal_conference/config/locales/en.yml +++ b/vendor/built_in_modules/personal_conference/config/locales/en.yml @@ -28,11 +28,13 @@ en: file_name : "File Name" description : "File Description" + create_success : "Successfully Create" + update_success : "Successfully Update" + delete_success : "Successfully Delete" add: "Add" back: "Back" delete: "Delete" edit: "Edit" - no_: "No" nothing: "Nothing" show: "Show" sure?: "Are you sure?" diff --git a/vendor/built_in_modules/personal_conference/config/locales/zh_tw.yml b/vendor/built_in_modules/personal_conference/config/locales/zh_tw.yml index 177f9c03..967d14d0 100644 --- a/vendor/built_in_modules/personal_conference/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/personal_conference/config/locales/zh_tw.yml @@ -28,11 +28,12 @@ zh_tw: file_name : "檔案名稱" description : "描述" + create_success : "新增完成!!" + update_success : "更新完成!!" add: "新增" back: "返回" delete: "刪除" edit: "編輯" - no_: "No" nothing: "無" show: "顯示" sure?: "您肯定嗎?" diff --git a/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb b/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb index eff597fb..42210178 100644 --- a/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb +++ b/vendor/built_in_modules/personal_journal/app/controllers/panel/personal_journal/desktop/journal_pages_controller.rb @@ -22,13 +22,24 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr @level_types = JournalLevelType.all @author_types = JournalAuthorType.all @paper_types= JournalPaperType.all - @journal_co_author_candidate = - JournalCoAuthor.where(name_id: current_user.id).map{|c|c.co_author} + #@journal_co_author_candidate = + # JournalCoAuthor.where(name_id: current_user.id).map{|c|c.co_author} @journal_candidate = WritingJournal.where(create_user_id: current_user.id).map{|j|j.journal_title}.uniq + if (not params[:q].nil?) and (current_user.name.include?params[:q]) + @user = [{ :id => 0, :name => current_user.name}] # self account name + else + @user = [] + end + + @co_authors = JournalCoAuthor.where(name_id: current_user.id, :co_author => /#{params[:q]}/) + @co_authors = [{ :id => params[:q], :name => params[:q] }] + # search string + @user + # self account name + @co_authors.map{|m| { :id => m.id, :name => m.co_author } } # match pattern respond_to do |format| format.html { render :layout => false} + format.json { render :json => @co_authors.to_json } end end @@ -48,7 +59,7 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr @writing_journal = WritingJournal.new(params[:writing_journal]) if @writing_journal.save - render json: {success: true, msg: t('create.success.paper')}.to_json + render json: {success: true, msg: t('create_success')}.to_json else error_msg = @writing_journal.errors.full_messages.join("
    ") render json: {success: false, msg: error_msg}.to_json @@ -60,31 +71,23 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr @writing_journal= WritingJournal.find(params[:id]) if @writing_journal.update_attributes(params[:writing_journal]) - render json: {success: true, msg: t('update.success.paper')}.to_json + render json: {success: true, msg: t('update_success')}.to_json else error_msg = @writing_journal.errors.full_messages.join("
    ") render json: {success: false, msg: error_msg}.to_json end end - def check_file_type file - if not file.nil? - file_type = MIME::Types.type_for(file).first.to_s.split("/")[1] - file_type = "/assets/ft-icons/#{file_type}/#{file_type}-48_32.png" - else - file_type = "" - end - end - def destroy @writing_journal = WritingJournal.find(params[:id]) @writing_journal.destroy - render :json => {success: true, msg: t('delete.success.paper')} + render :json => {success: true, msg: t('delete_success')} end def journal_type level_types = JournalLevelType.all all_journal_lists = WritingJournal.where(create_user_id: current_user.id) + all_journal_lists = all_journal_lists.asc(:journal_title) all_journal_lists = all_journal_lists.map do |j| [ j.journal_title, j.journal_level_type_ids.map do |type| diff --git a/vendor/built_in_modules/personal_journal/app/helpers/panel/personal_journal/desktop/journal_pages_helper.rb b/vendor/built_in_modules/personal_journal/app/helpers/panel/personal_journal/desktop/journal_pages_helper.rb index 747d724a..291f7fe9 100644 --- a/vendor/built_in_modules/personal_journal/app/helpers/panel/personal_journal/desktop/journal_pages_helper.rb +++ b/vendor/built_in_modules/personal_journal/app/helpers/panel/personal_journal/desktop/journal_pages_helper.rb @@ -6,15 +6,20 @@ module Panel::PersonalJournal::Desktop::JournalPagesHelper marker + \ content(publication, view) + \ edit_or_delete(publication) - end end def marker content_tag :div, :class => "list_item_action" - content_tag(:a, "",:href=>"", :class => "icon-check-empty", "toggle-onclick"=>"icon-check-empty icon-check", "ajax-remote"=>"false") + \ - content_tag(:a, "",:href=>"", :class => "icon-star-empty", "toggle-onclick"=>"icon-star-empty icon-star", "ajax-remote"=>"false") + content_tag(:a, "",:href=>"", + :class => "icon-check-empty", + "toggle-onclick"=>"icon-check-empty icon-check", + "ajax-remote"=>"false") + \ + content_tag(:a, "",:href=>"", + :class => "icon-star-empty", + "toggle-onclick"=>"icon-star-empty icon-star", + "ajax-remote"=>"false") end def content publication, view @@ -73,4 +78,16 @@ module Panel::PersonalJournal::Desktop::JournalPagesHelper file_type = "" end end + + def generate_authors_name ids + author_name = ids.map{|m| + if m == "0" + {:id => 0, :name => current_user.name} + else + {:id => m, :name => ConferenceCoAuthor.find(m).co_author} + end + } + + author_name.to_json + end end diff --git a/vendor/built_in_modules/personal_journal/app/models/journal_co_author.rb b/vendor/built_in_modules/personal_journal/app/models/journal_co_author.rb index 5d8617c7..4edf44b2 100644 --- a/vendor/built_in_modules/personal_journal/app/models/journal_co_author.rb +++ b/vendor/built_in_modules/personal_journal/app/models/journal_co_author.rb @@ -8,6 +8,7 @@ class JournalCoAuthor field :email belongs_to :journal_co_author_relations + has_and_belongs_to_many :writing_journals VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/ validates :email, format: { with: VALID_EMAIL_REGEX }, diff --git a/vendor/built_in_modules/personal_journal/app/models/writing_journal.rb b/vendor/built_in_modules/personal_journal/app/models/writing_journal.rb index 7374abbf..8c721b64 100644 --- a/vendor/built_in_modules/personal_journal/app/models/writing_journal.rb +++ b/vendor/built_in_modules/personal_journal/app/models/writing_journal.rb @@ -12,6 +12,7 @@ class WritingJournal has_and_belongs_to_many :tags, :class_name => "PersonalJournalTag" has_and_belongs_to_many :journal_author_types has_and_belongs_to_many :journal_level_types + has_and_belongs_to_many :journal_co_authors has_many :writing_journal_files, :autosave => true, :dependent => :destroy belongs_to :journal_paper_type @@ -35,25 +36,44 @@ class WritingJournal accepts_nested_attributes_for :writing_journal_files, :allow_destroy => true after_save :save_writing_journal_files before_validation :add_http - before_save :save_co_author + #before_save :save_co_author validates :paper_title, :at_least_one => true validates :url, :format => /^(http|https):\/\/(([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5})|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(:[0-9]{1,5})?(\/.*)?/i, :unless => Proc.new{self.url.blank?} - def save_co_author - authors_list = authors.split(",").map{|n| n.strip.gsub(/\s+/," ")}.reject{|n| n.empty? } - if new_record? - current_user = create_user_id - else - current_user = update_user_id - end + attr_reader :author_tokens - authors_db = JournalCoAuthor.where(:name_id => current_user).map(&:co_author) - authors_list.delete(User.find(current_user).name) - authors_list = authors_list.delete_if{|author| authors_db.include?author} - authors_list.each do |author| - JournalCoAuthor.new(:co_author => author, :name_id => current_user).save - end + def author_tokens=(ids) + authors_ids = ids.split(",").map{|id| + begin + JournalCoAuthor.find(m).id + rescue + if id != "0" + new_co_author = JournalCoAuthor.new(:co_author => id, :name_id => create_user_id) + new_co_author.save + new_co_author.id + else + id + end + end + } + self.journal_co_author_ids = authors_ids end + # old method + #def save_co_author + # authors_list = authors.split(",").map{|n| n.strip.gsub(/\s+/," ")}.reject{|n| n.empty? } + # if new_record? + # current_user = create_user_id + # else + # current_user = update_user_id + # end + + # authors_db = JournalCoAuthor.where(:name_id => current_user).map(&:co_author) + # authors_list.delete(User.find(current_user).name) + # authors_list = authors_list.delete_if{|author| authors_db.include?author} + # authors_list.each do |author| + # JournalCoAuthor.new(:co_author => author, :name_id => current_user).save + # end + #end def self.search( category_id = nil ) if category_id.to_s.size > 0 diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_author_relations/_show_form.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_author_relations/_show_form.html.erb index 29801f0b..4efbace0 100644 --- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_author_relations/_show_form.html.erb +++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_author_relations/_show_form.html.erb @@ -1,11 +1,11 @@
      -<% @journal_co_author_relations.each_with_index do |journal_co_author_relation,i| %> -
    • -
      <%= journal_co_author_relation.relation %>
      -
      - <%= link_to 'Edit', edit_panel_personal_journal_desktop_journal_co_author_relation_path(journal_co_author_relation), :class => "bt-edit-type admbg2 admtxt", "content-holder"=>"#form_space_"+i.to_s, "ajax-remote"=>"get" %> - <%= link_to 'Destroy', panel_personal_journal_desktop_journal_co_author_relation_path(journal_co_author_relation), "confirm-message"=>'Are you sure?', "ajax-remote"=>"delete", :class=>"bt-delete admbg2 admtxt" %> -
      -
    • -<% end %> + <% @journal_co_author_relations.each_with_index do |journal_co_author_relation,i| %> +
    • +
      <%= journal_co_author_relation.relation %>
      +
      + <%= link_to t('edit'), edit_panel_personal_journal_desktop_journal_co_author_relation_path(journal_co_author_relation), :class => "bt-edit-type admbg2 admtxt", "content-holder"=>"#form_space_"+i.to_s, "ajax-remote"=>"get" %> + <%= link_to t('delete'), panel_personal_journal_desktop_journal_co_author_relation_path(journal_co_author_relation), "confirm-message"=>t('sure?'), "ajax-remote"=>"delete", :class=>"bt-delete admbg2 admtxt" %> +
      +
    • + <% end %>
    diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_authors/index.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_authors/index.html.erb index 0200dfe4..fa6d19fa 100644 --- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_authors/index.html.erb +++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_authors/index.html.erb @@ -8,9 +8,9 @@
    -
      +
        <% @journal_co_authors.each_with_index do |co_author,i| %> - +
        • <%= co_author.co_author %>
        • @@ -18,11 +18,10 @@
        • <%= @journal_co_author_relations.find(co_author.journal_co_author_relations_id).relation unless co_author.journal_co_author_relations_id.nil?%>
        - <%= link_to 'Edit', edit_panel_personal_journal_desktop_journal_co_author_path(co_author), :class => "bt-edit admbg2 admtxt", "ajax-remote"=>"get" %> - <%= link_to 'Destroy', panel_personal_journal_desktop_journal_co_author_path(co_author), "ajax-remote"=>"delete", "confirm-message"=>'Are you sure?', "callback-method"=>"paperDelete", :class=>"bt-delete admbg2 admtxt" %> + <%= link_to t('edit'), edit_panel_personal_journal_desktop_journal_co_author_path(co_author), :class => "bt-edit admbg2 admtxt", "ajax-remote"=>"get" %> + <%= link_to t('delete'), panel_personal_journal_desktop_journal_co_author_path(co_author), "ajax-remote"=>"delete", "confirm-message"=>t('sure?'), "callback-method"=>"paperDelete", :class=>"bt-delete admbg2 admtxt" %>
        -
      • - + <% end %>
    diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb index 817567a0..efe3fc7d 100644 --- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb +++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb @@ -1,8 +1,8 @@
    - <%= f.submit "Save", name: "commit", value: "Save", class: "fn_btn ini_input hp hh2 thmc2 thmtxt" %> + <%= f.submit t("save"), name: "commit", value: "Save", class: "fn_btn ini_input hp hh2 thmc2 thmtxt" %> <% if not @writing_journal.new_record? %> - <%= submit_tag "Cancel", :type => "button", "ajax-remote" => "get", :href => panel_personal_journal_desktop_journal_pages_path, class: "ini_input hp hh2 thmadm thmtxt" %> + <%= submit_tag t("cancel"), :type => "button", "ajax-remote" => "get", :href => panel_personal_journal_desktop_journal_pages_path, class: "ini_input hp hh2 thmadm thmtxt" %> <% end %>
    @@ -25,10 +25,10 @@
    -
    -
    -
      -
    • +
      +
      +
        +
      • <%= f.fields_for :paper_title_translations do |f| %> <%= f.text_area locale, class: "s_grid_6 s_grid", @@ -36,8 +36,8 @@ placeholder: t("personal_journal.paper_title"), value: (@writing_journal.paper_title_translations[locale.to_s] rescue nil) %> <% end %> -
      • -
      • +
      • +
      • <%= f.fields_for :journal_title_translations do |f| %> <%= f.text_field locale, size: "20", @@ -47,122 +47,128 @@ value: (@writing_journal.journal_title_translations[locale.to_s] rescue nil) %> <% end %> -
      • -
      • -
        - <%= label_tag("", t("personal_journal.level_type")) %> -
          - <% @level_types.each_with_index do |level_type, i| %> -
        • - <%= check_box_tag "writing_journal[journal_level_type_ids][]", - level_type.id, - @writing_journal.journal_level_type_ids.include?(level_type.id), - id: "field-#{i}" - %><%= label_tag("field-#{i}", level_type.title) %> -
        • - <% end %> -
        -
        -
      • + +
      • +
        + <%= label_tag("", t("personal_journal.level_type")) %> +
          + <% @level_types.each_with_index do |level_type, i| %> +
        • + <%= check_box_tag "writing_journal[journal_level_type_ids][]", + level_type.id, + @writing_journal.journal_level_type_ids.include?(level_type.id), + id: "field-#{i}" + %><%= label_tag("field-#{i}", level_type.title) %> +
        • + <% end %> +
        +
        +
      • -
      • +
      • <%= label_tag("", t("personal_journal.isbn"), class: "s_grid_2 s_grid") %><%= f.text_field :isbn, size: "20", placeholder: "829872987", class: "s_grid_4 s_grid"%> -
      • + -
      • +
      • <%= label_tag("", t("personal_journal.vol_no"), class: "s_grid_2 s_grid") %><%= f.text_field :vol_no, size: "20", placeholder: "829872987", class: "s_grid_4 s_grid"%> -
      • + -
      • +
      • <%= label_tag("", t("personal_journal.issue_no"), class: "s_grid_2 s_grid") %><%= f.text_field :issue_no, size: "20", placeholder:"829872987", class: "s_grid_4 s_grid"%> -
      • + -
      • +
      • <%= label_tag("", t("personal_journal.total_pages"), class: "s_grid_2 s_grid") %><%= f.text_field :total_pages, size: "20", placeholder:"20", class: "s_grid_4 s_grid"%> -
      • + -
      • +
      • <%= label_tag("", t("personal_journal.total_pages"), class: "s_grid_2 s_grid") %><%= label_tag("", t("personal_journal.from"), class: "s_grid_1 s_grid") %><%= f.text_field :form_to_start, size: "10", placeholder: "1", class: "s_grid_1 s_grid"%><%= label_tag("", t("personal_journal.to"), class: "s_grid_1 s_grid") %><%= f.text_field :form_to_end, size: "10", placeholder: "20", class: "s_grid_1 s_grid"%> -
      • -
      +
    • +
    +
    -
    -
    -
    -
      -
    • - <%= f.fields_for :authors_translations do |f| %> - <%= f.text_area locale, +
      +
      +
        +
      • + <%= f.label :author_tokens, t("personal_journal.authors") %>
        + <%= f.text_area :author_tokens, + class: "s_grid_6 s_grid", + size: "20x2", + placeholder: t("personal_journal.authors"), + "data-pre" => generate_authors_name(@writing_journal.journal_co_author_ids) %> + <%#= f.fields_for :authors_translations do |f| %> + <%#= f.text_area locale, class: "s_grid_6 s_grid", size: "20x2", placeholder: t("personal_journal.authors"), "autocomplete-list" => "coauthor_autocomplete_list", value: (@writing_journal.authors_translations[locale.to_s] rescue nil) %> - <% end %> + <%# end %> -
      • -
      • +
      • +
      • - + - -
      • -
      • - <%= label_tag("", t("personal_journal.publication_date"), class: "s_grid_3 s_grid") %> - <%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 's_grid_1 s_grid'} %> -
      • -
      • - <%= f.text_field :keywords, size: "20", placeholder: t("personal_journal.keywords"), class: "s_grid_6 s_grid"%> -
      • + + +
      • + <%= label_tag("", t("personal_journal.publication_date"), class: "s_grid_3 s_grid") %> + <%= f.date_select :publication_date, {:use_month_numbers => true, :start_year => Time.now.year, :end_year => 1930, :order => [:year, :month, :day] }, {:class => 's_grid_1 s_grid'} %> +
      • +
      • + <%= f.text_field :keywords, size: "20", placeholder: t("personal_journal.keywords"), class: "s_grid_6 s_grid"%> +
      • -
      • - <%= f.label :year, t("personal_journal.year"), :class => "s_grid_2 s_grid" %> - <%= select_year((@writing_journal.year ? @writing_journal.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_journal[year]', :class => "s_grid_4 s_grid"} ) %> -
      • +
      • + <%= f.label :year, t("personal_journal.year"), :class => "s_grid_2 s_grid" %> + <%= select_year((@writing_journal.year ? @writing_journal.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year, :end_year => 1930}, {:name => 'writing_journal[year]', :class => "s_grid_4 s_grid"} ) %> +
      • -
      • - <%= f.label :language, t("personal_journal.language"),:class => "s_grid_2 s_grid" %> - <%= f.select :language, - WritingJournal::LANGUAGE_TYPES, - class: "s_grid s_grid_4" %> - -
      • +
      • + <%= f.label :language, t("personal_journal.language"),:class => "s_grid_2 s_grid" %> + <%= f.select :language, + WritingJournal::LANGUAGE_TYPES, + class: "s_grid s_grid_4" %> + +
      • -
      • -
      • >
      • - - -
      • - -
      • -
      • - <%= label_tag("", t("personal_journal.url"), class: "s_grid_2 s_grid") %><%= f.text_field :url, size: "20", placeholder: "www.sample.com", class: "s_grid_4 s_grid"%> -
      • -
      -
      +
    • +
    • >
    • + + +
    • + +
    • +
    • + <%= label_tag("", t("personal_journal.url"), class: "s_grid_2 s_grid") %><%= f.text_field :url, size: "20", placeholder: "www.sample.com", class: "s_grid_4 s_grid"%> +
    • +
    +
    -
    +
    • @@ -193,39 +199,36 @@
    • +
    -
    -
    -
    -
      -
    • +
      +
      +
        +
      • <%= f.text_area :note, size: "20x22", placeholder: t("personal_journal.note"), class: "s_grid_6 s_grid full_height"%> -
      • -
      +
    • +
    +
    -
    -
    -
    -
      -
    • +
      +
      +
        +
      • <%= f.text_area :abstract, size: "20x22", placeholder: t("personal_journal.abstract"), class: "s_grid_6 s_grid full_height"%> -
      • -
      +
    • +
    +
    -
    diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/journal_type.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/journal_type.html.erb index 5dd58143..b9baa9ef 100644 --- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/journal_type.html.erb +++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/journal_type.html.erb @@ -17,24 +17,20 @@
    - <% @journal_lists.each_with_index do |journal_list,i| %> - <% if ( i % 5 ) == 0 %> -
    -
      - <% end %> -
    • -
      - -
      - <% title, level = journal_list %> -
      <%= title %>
      -
      <%= level.join(",") %>
      -
    • - <% if ( i % 5 ) == 4 %> -
    + <% @journal_lists.each_with_index do |journal_list,i| %> +
    +
      +
    • +
      +
      - <% end %> - <% end %> + <% title, level = journal_list %> +
      <%= title %>
      +
      <%= level.join(",") %>
      +
    • +
    +
    + <% end %>
    diff --git a/vendor/built_in_modules/personal_journal/config/locales/en.yml b/vendor/built_in_modules/personal_journal/config/locales/en.yml index f692a937..f009368d 100644 --- a/vendor/built_in_modules/personal_journal/config/locales/en.yml +++ b/vendor/built_in_modules/personal_journal/config/locales/en.yml @@ -24,6 +24,25 @@ en: file : "File" file_name : "File name" description : "File Description" - add : "Add" - edit : "Edit" - delete : "Destory" + + create_success : "Successfully Create" + update_success : "Successfully Update" + delete_success : "Successfully Delete" + add: "Add" + back: "Back" + delete: "Delete" + edit: "Edit" + nothing: "Nothing" + show: "Show" + sure?: "Are you sure?" + update: "Update" + yes_: "Yes" + no_: "No" + cancel : "Cancel" + save: "save" + hintText: "Type in a search term" + noResultsText: "No results" + searchingText: "Searching…" + + error_msg: + time_series_illegal: "must be before end time" diff --git a/vendor/built_in_modules/personal_journal/config/locales/zh_tw.yml b/vendor/built_in_modules/personal_journal/config/locales/zh_tw.yml index ed89a4d7..ef7a3cdd 100644 --- a/vendor/built_in_modules/personal_journal/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/personal_journal/config/locales/zh_tw.yml @@ -26,6 +26,25 @@ zh_tw: file : "檔案" file_name : "檔案名稱" description : "描述" - add : "新增" - edit : "編輯" - delete : "刪除" + + create_success : "新增完成!!" + update_success : "更新完成!!" + delete_success : "刪除成功!!" + add: "新增" + back: "返回" + delete: "刪除" + edit: "編輯" + nothing: "無" + show: "顯示" + sure?: "您肯定嗎?" + update: "更新" + yes_: "是" + no_: "否" + cancel : "取消" + save: "儲存" + hintText: "請輸入搜尋關鍵字" + noResultsText: "沒有相關的比對結果" + searchingText: "搜尋中…" + + error_msg: + time_series_illegal: "啟始時間必須早於結束時間" From 874648eacff713fe9326dba31fb194d102f103c4 Mon Sep 17 00:00:00 2001 From: Rueshyna Date: Mon, 4 Mar 2013 17:27:36 +0800 Subject: [PATCH 12/13] add Devin's css file for gallery --- .../gallery/app/assets/stylesheets/gallery_frontend.css | 4 ++-- .../gallery/app/assets/stylesheets/widget_gallery.css | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) mode change 100755 => 100644 vendor/built_in_modules/gallery/app/assets/stylesheets/gallery_frontend.css mode change 100755 => 100644 vendor/built_in_modules/gallery/app/assets/stylesheets/widget_gallery.css diff --git a/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery_frontend.css b/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery_frontend.css old mode 100755 new mode 100644 index 7e9b2421..f449178d --- a/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery_frontend.css +++ b/vendor/built_in_modules/gallery/app/assets/stylesheets/gallery_frontend.css @@ -231,7 +231,7 @@ .slidelist { position: absolute; bottom: 30px; - z-index: 99; + z-index: 98; width: 100%; height: 0; overflow: auto; @@ -251,7 +251,7 @@ border: solid 2px #fff; display: block; width: 120px; - height: 90px; + height: 96px; position: relative; box-shadow: 0 0 6px rgba(0,0,0,0.7); diff --git a/vendor/built_in_modules/gallery/app/assets/stylesheets/widget_gallery.css b/vendor/built_in_modules/gallery/app/assets/stylesheets/widget_gallery.css old mode 100755 new mode 100644 index df7bf2c2..dd9f9594 --- a/vendor/built_in_modules/gallery/app/assets/stylesheets/widget_gallery.css +++ b/vendor/built_in_modules/gallery/app/assets/stylesheets/widget_gallery.css @@ -32,9 +32,13 @@ .w1.c4 li { width: 23%; } .w1.c5 li { width: 18%; } .w1.c6 li { width: 14.6666%; } +.w1 li a { + -webkit-transition: opacity 0.3s ease; + -moz-transition: opacity 0.3s ease; + transition: opacity 0.3s ease; +} .w1 li a:hover { - box-shadow: 0 0 20px rgba(0,0,0,0.9); - outline: solid 4px #429DFF; + opacity: 0.8; position: relative; } .w1 li a img { From b5abbc9ef006bd2e416adef4165bbbea9cf4b3cb Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Mon, 4 Mar 2013 17:44:55 +0800 Subject: [PATCH 13/13] =?UTF-8?q?highlighting=20fixed=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/javascripts/orbitdesktop.js | 17 +++++++++++++++-- .../desktop/journal_pages/_form.html.erb | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index cc47a507..12f194b1 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -395,8 +395,21 @@ var orbitDesktop = function(dom){ // }) } - $('*[content-type=menu] a').removeClass('thmc1 thmtxt active'); - dom.addClass('thmc1 thmtxt active'); + // $('*[content-type=menu] a').removeClass('thmc1 thmtxt active'); + // dom.addClass('thmc1 thmtxt active'); + o.highlight_sub_menu_item(dom); + } + this.highlight_sub_menu_item = function(no){ + $('*[content-type=menu] a').removeClass('thmc1 thmtxt active'); + var dom; + if(typeof no == "number"){ + dom = $('*[content-type=menu] a').eq(no); + dom.addClass('thmc1 thmtxt active'); + }else if(typeof no == "object"){ + dom = no; + dom.addClass('thmc1 thmtxt active'); + } + return dom; } this.initializeDesktop = function(target,url,cache){ //this is for initializing main desktops that are sections and tiles diff --git a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb index efe3fc7d..6a30de41 100644 --- a/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb +++ b/vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/_form.html.erb @@ -229,6 +229,6 @@