carrier 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +27 -0
- data/LICENSE.txt +20 -0
- data/MIT-LICENSE +20 -0
- data/README.textile +111 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/app/assets/images/.gitkeep +0 -0
- data/app/assets/javascripts/autocomplete.js +4 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery-ui-i18n.js +1379 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-af.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ar-DZ.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ar.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-az.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-bg.js +24 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-bs.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ca.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-cs.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-da.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-de.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-el.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-en-AU.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-en-GB.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-en-NZ.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-eo.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-es.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-et.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-eu.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fa.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fi.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fo.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fr-CH.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-fr.js +25 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-gl.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-he.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-hr.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-hu.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-hy.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-id.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-is.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-it.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ja.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ko.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-kz.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-lt.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-lv.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ml.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ms.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-nl.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-no.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-pl.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-pt-BR.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-pt.js +22 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-rm.js +21 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ro.js +26 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ru.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sk.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sl.js +24 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sq.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sr-SR.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sr.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-sv.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-ta.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-th.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-tj.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-tr.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-uk.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-vi.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-zh-CN.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-zh-HK.js +23 -0
- data/app/assets/javascripts/autocomplete/i18n/jquery.ui.datepicker-zh-TW.js +23 -0
- data/app/assets/javascripts/autocomplete/jquery.ui.autocomplete.min.js +32 -0
- data/app/assets/javascripts/autocomplete/jquery.ui.core.min.js +17 -0
- data/app/assets/javascripts/autocomplete/jquery.ui.position.min.js +16 -0
- data/app/assets/javascripts/autocomplete/jquery.ui.widget.min.js +15 -0
- data/app/assets/javascripts/carrier.js +8 -0
- data/app/assets/javascripts/jquery.min.js +16 -0
- data/app/assets/javascripts/rails.js +169 -0
- data/app/assets/javascripts/rich-multiselect/jquery-ui.min.js +405 -0
- data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-de.js +11 -0
- data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-en.js +11 -0
- data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-es.js +11 -0
- data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-fr.js +11 -0
- data/app/assets/javascripts/rich-multiselect/locale/ui-multiselect-it.js +13 -0
- data/app/assets/javascripts/rich-multiselect/plugins/localisation/jquery.localisation-min.js +7 -0
- data/app/assets/javascripts/rich-multiselect/plugins/localisation/jquery.localisation-pack.js +7 -0
- data/app/assets/javascripts/rich-multiselect/plugins/localisation/jquery.localisation.js +99 -0
- data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/README.txt +37 -0
- data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/changes.txt +82 -0
- data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/jquery.scrollTo-min.js +11 -0
- data/app/assets/javascripts/rich-multiselect/plugins/scrollTo/jquery.scrollTo.js +207 -0
- data/app/assets/javascripts/rich-multiselect/ui.multiselect.js +339 -0
- data/app/assets/stylesheets/carrier.css +227 -0
- data/app/assets/stylesheets/carrier_rich.css +48 -0
- data/app/assets/stylesheets/carrier_simple.css +15 -0
- data/app/assets/stylesheets/rich-multiselect/ui.multiselect.css +30 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_55_fbf9ee_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_65_ffffff_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_cccccc_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_dadada_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_e6e6e6_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-bg_flat_95_fef1ec_40x100.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-icons_888888_256x240.png +0 -0
- data/app/assets/stylesheets/ui-lightness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/stylesheets/ui-lightness/jquery-ui-1.8.14.custom.css +342 -0
- data/app/controllers/carrier/application_controller.rb +5 -0
- data/app/controllers/carrier/chains_controller.rb +16 -0
- data/app/controllers/carrier/messages_controller.rb +59 -0
- data/app/helpers/carrier/application_helper.rb +26 -0
- data/app/helpers/carrier/post_helper.rb +4 -0
- data/app/models/carrier/chain.rb +59 -0
- data/app/models/carrier/message.rb +118 -0
- data/app/models/carrier/message/scopes.rb +51 -0
- data/app/models/carrier/message/subject.rb +25 -0
- data/app/models/carrier/message/validations.rb +7 -0
- data/app/validators/recipients/exclude_self.rb +10 -0
- data/app/validators/recipients/recipients_validator.rb +10 -0
- data/app/views/carrier/chains/archive.js.erb +1 -0
- data/app/views/carrier/chains/unarchive.js.erb +1 -0
- data/app/views/carrier/messages/_archive_chain.html.erb +6 -0
- data/app/views/carrier/messages/_form.html.erb +30 -0
- data/app/views/carrier/messages/_head.html.erb +8 -0
- data/app/views/carrier/messages/_index_message.html.erb +13 -0
- data/app/views/carrier/messages/_message_collapsed.html.erb +12 -0
- data/app/views/carrier/messages/_message_expanded.html.erb +10 -0
- data/app/views/carrier/messages/_nav_messages.html.erb +15 -0
- data/app/views/carrier/messages/_reply.html.erb +19 -0
- data/app/views/carrier/messages/as_sent.html.erb +36 -0
- data/app/views/carrier/messages/collapsed.js.erb +1 -0
- data/app/views/carrier/messages/create.js.erb +1 -0
- data/app/views/carrier/messages/expanded.js.erb +1 -0
- data/app/views/carrier/messages/index.html.erb +9 -0
- data/app/views/carrier/messages/new.html.erb +7 -0
- data/app/views/carrier/messages/new.js.erb +1 -0
- data/app/views/carrier/messages/reply.js.erb +6 -0
- data/app/views/carrier/messages/rich/_multiselect.html.erb +18 -0
- data/app/views/carrier/messages/rich/_recipients.html.erb +6 -0
- data/app/views/carrier/messages/show.html.erb +35 -0
- data/app/views/carrier/messages/simple/_autocomplete.html.erb +45 -0
- data/app/views/carrier/messages/simple/_autocomplete_includes.html.erb +7 -0
- data/app/views/carrier/messages/simple/_recipients.html.erb +3 -0
- data/app/views/layouts/carrier/application.html.erb +16 -0
- data/app/views/partials/_error_messages_for.html.erb +9 -0
- data/carrier.gemspec +331 -0
- data/config/locales/carrier.en.yml +48 -0
- data/config/locales/carrier.ru.yml +48 -0
- data/config/routes.rb +24 -0
- data/db/migrate/001_create_messages.rb +26 -0
- data/db/migrate/002_create_chains.rb +34 -0
- data/db/migrate/003_create_read_marks +16 -0
- data/lib/carrier.rb +22 -0
- data/lib/carrier/configuration.rb +35 -0
- data/lib/carrier/configuration/models.rb +31 -0
- data/lib/carrier/configuration/ui.rb +28 -0
- data/lib/carrier/rails.rb +5 -0
- data/lib/carrier/rails/engine.rb +50 -0
- data/lib/carrier/rails/helpers.rb +30 -0
- data/lib/tasks/carrier_tasks.rake +4 -0
- data/script/rails +6 -0
- data/spec/carrier/app/controllers/application_controller_spec.rb +1 -0
- data/spec/carrier/app/models/message_scopes_spec.rb +25 -0
- data/spec/carrier/app/models/message_spec.rb +38 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +9 -0
- data/spec/dummy/app/assets/javascripts/default.js +2 -0
- data/spec/dummy/app/assets/javascripts/jquery.js +16 -0
- data/spec/dummy/app/assets/javascripts/jquery_ujs.js +169 -0
- data/spec/dummy/app/assets/javascripts/posts.js +2 -0
- data/spec/dummy/app/assets/stylesheets/application.css +7 -0
- data/spec/dummy/app/assets/stylesheets/default.css +4 -0
- data/spec/dummy/app/assets/stylesheets/posts.css +4 -0
- data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/default_controller.rb +5 -0
- data/spec/dummy/app/controllers/posts_controller.rb +83 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/default_helper.rb +2 -0
- data/spec/dummy/app/helpers/posts_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/models/post.rb +2 -0
- data/spec/dummy/app/models/user.rb +15 -0
- data/spec/dummy/app/views/default/index.html.erb +4 -0
- data/spec/dummy/app/views/devise/confirmations/new.html.erb +12 -0
- data/spec/dummy/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/spec/dummy/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/spec/dummy/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/spec/dummy/app/views/devise/passwords/edit.html.erb +16 -0
- data/spec/dummy/app/views/devise/passwords/new.html.erb +12 -0
- data/spec/dummy/app/views/devise/registrations/edit.html.erb +25 -0
- data/spec/dummy/app/views/devise/registrations/new.html.erb +18 -0
- data/spec/dummy/app/views/devise/sessions/new.html.erb +17 -0
- data/spec/dummy/app/views/devise/shared/_links.erb +25 -0
- data/spec/dummy/app/views/devise/unlocks/new.html.erb +12 -0
- data/spec/dummy/app/views/layouts/application.html.erb +16 -0
- data/spec/dummy/app/views/posts/_form.html.erb +17 -0
- data/spec/dummy/app/views/posts/edit.html.erb +6 -0
- data/spec/dummy/app/views/posts/index.html.erb +21 -0
- data/spec/dummy/app/views/posts/new.html.erb +5 -0
- data/spec/dummy/app/views/posts/show.html.erb +5 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +51 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +26 -0
- data/spec/dummy/config/database_mysql.yml +29 -0
- data/spec/dummy/config/database_pgsql.yml +35 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +24 -0
- data/spec/dummy/config/environments/production.rb +52 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/carrier.rb +3 -0
- data/spec/dummy/config/initializers/devise.rb +204 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/spec/dummy/config/locales/devise.en.yml +53 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +15 -0
- data/spec/dummy/db/migrate/007_devise_create_users.rb +29 -0
- data/spec/dummy/db/migrate/20110130210000_create_read_marks.rb +16 -0
- data/spec/dummy/db/migrate/20110814064637_create_posts.rb +8 -0
- data/spec/dummy/db/migrate/20110814164228_create_messages.rb +26 -0
- data/spec/dummy/db/migrate/20110814164229_create_chains.rb +34 -0
- data/spec/dummy/db/schema.rb +79 -0
- data/spec/dummy/db/seeds.rb +26 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/test/fixtures/posts.yml +11 -0
- data/spec/dummy/test/fixtures/users.yml +11 -0
- data/spec/dummy/test/functional/default_controller_test.rb +9 -0
- data/spec/dummy/test/functional/posts_controller_test.rb +49 -0
- data/spec/dummy/test/unit/helpers/default_helper_test.rb +4 -0
- data/spec/dummy/test/unit/helpers/posts_helper_test.rb +4 -0
- data/spec/dummy/test/unit/post_test.rb +7 -0
- data/spec/dummy/test/unit/user_test.rb +7 -0
- data/spec/dummy_spec_helper.rb +70 -0
- data/spec/integration/carrier_spec.rb +71 -0
- data/spec/requests/main_spec.rb +31 -0
- data/spec/support/controller_macros.rb +10 -0
- data/spec/support/factories.rb +47 -0
- data/spec/support/rspec_helpers.rb +22 -0
- data/test/helper.rb +18 -0
- data/test/test_carrier.rb +7 -0
- metadata +450 -0
@@ -0,0 +1,339 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery UI Multiselect
|
3
|
+
*
|
4
|
+
* Authors:
|
5
|
+
* Michael Aufreiter (quasipartikel.at)
|
6
|
+
* Yanick Rochon (yanick.rochon[at]gmail[dot]com)
|
7
|
+
*
|
8
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
9
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
10
|
+
*
|
11
|
+
* http://www.quasipartikel.at/multiselect/
|
12
|
+
*
|
13
|
+
*
|
14
|
+
* Depends:
|
15
|
+
* ui.core.js
|
16
|
+
* ui.sortable.js
|
17
|
+
*
|
18
|
+
* Optional:
|
19
|
+
* localization (http://plugins.jquery.com/project/localisation)
|
20
|
+
* scrollTo (http://plugins.jquery.com/project/ScrollTo)
|
21
|
+
*
|
22
|
+
* Todo:
|
23
|
+
* Make batch actions faster
|
24
|
+
* Implement dynamic insertion through remote calls
|
25
|
+
*/
|
26
|
+
|
27
|
+
|
28
|
+
(function($) {
|
29
|
+
|
30
|
+
$.widget("ui.multiselect", {
|
31
|
+
options: {
|
32
|
+
sortable: true,
|
33
|
+
searchable: true,
|
34
|
+
doubleClickable: true,
|
35
|
+
animated: 'fast',
|
36
|
+
show: 'slideDown',
|
37
|
+
hide: 'slideUp',
|
38
|
+
dividerLocation: 0.6,
|
39
|
+
nodeComparator: function(node1,node2) {
|
40
|
+
var text1 = node1.text(),
|
41
|
+
text2 = node2.text();
|
42
|
+
return text1 == text2 ? 0 : (text1 < text2 ? -1 : 1);
|
43
|
+
}
|
44
|
+
},
|
45
|
+
_create: function() {
|
46
|
+
this.element.hide();
|
47
|
+
this.id = this.element.attr("id");
|
48
|
+
this.container = $('<div class="ui-multiselect ui-helper-clearfix ui-widget"></div>').insertAfter(this.element);
|
49
|
+
this.count = 0; // number of currently selected options
|
50
|
+
|
51
|
+
// @stanislaw : next two lines's order changed
|
52
|
+
this.availableContainer = $('<div class="available"></div>').appendTo(this.container);
|
53
|
+
this.selectedContainer = $('<div class="selected"></div>').appendTo(this.container);
|
54
|
+
|
55
|
+
this.selectedActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><span class="count">0 '+$.ui.multiselect.locale.itemsCount+'</span><a href="#" class="remove-all">'+$.ui.multiselect.locale.removeAll+'</a></div>').appendTo(this.selectedContainer);
|
56
|
+
this.availableActions = $('<div class="actions ui-widget-header ui-helper-clearfix"><input type="text" class="search empty ui-widget-content ui-corner-all"/><a href="#" class="add-all">'+$.ui.multiselect.locale.addAll+'</a></div>').appendTo(this.availableContainer);
|
57
|
+
this.selectedList = $('<ul class="selected connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.selectedContainer);
|
58
|
+
this.availableList = $('<ul class="available connected-list"><li class="ui-helper-hidden-accessible"></li></ul>').bind('selectstart', function(){return false;}).appendTo(this.availableContainer);
|
59
|
+
|
60
|
+
var that = this;
|
61
|
+
|
62
|
+
// set dimensions
|
63
|
+
this.container.width(this.element.width()+1);
|
64
|
+
this.selectedContainer.width(Math.floor(this.element.width()*this.options.dividerLocation));
|
65
|
+
this.availableContainer.width(Math.floor(this.element.width()*(1-this.options.dividerLocation)));
|
66
|
+
|
67
|
+
// fix list height to match <option> depending on their individual header's heights
|
68
|
+
this.selectedList.height(Math.max(this.element.height()-this.selectedActions.height(),1));
|
69
|
+
this.availableList.height(Math.max(this.element.height()-this.availableActions.height(),1));
|
70
|
+
|
71
|
+
if ( !this.options.animated ) {
|
72
|
+
this.options.show = 'show';
|
73
|
+
this.options.hide = 'hide';
|
74
|
+
}
|
75
|
+
|
76
|
+
// init lists
|
77
|
+
this._populateLists(this.element.find('option'));
|
78
|
+
|
79
|
+
// make selection sortable
|
80
|
+
if (this.options.sortable) {
|
81
|
+
this.selectedList.sortable({
|
82
|
+
placeholder: 'ui-state-highlight',
|
83
|
+
axis: 'y',
|
84
|
+
update: function(event, ui) {
|
85
|
+
// apply the new sort order to the original selectbox
|
86
|
+
that.selectedList.find('li').each(function() {
|
87
|
+
if ($(this).data('optionLink'))
|
88
|
+
$(this).data('optionLink').remove().appendTo(that.element);
|
89
|
+
});
|
90
|
+
},
|
91
|
+
receive: function(event, ui) {
|
92
|
+
ui.item.data('optionLink').attr('selected', true);
|
93
|
+
// increment count
|
94
|
+
that.count += 1;
|
95
|
+
that._updateCount();
|
96
|
+
// workaround, because there's no way to reference
|
97
|
+
// the new element, see http://dev.jqueryui.com/ticket/4303
|
98
|
+
that.selectedList.children('.ui-draggable').each(function() {
|
99
|
+
$(this).removeClass('ui-draggable');
|
100
|
+
$(this).data('optionLink', ui.item.data('optionLink'));
|
101
|
+
$(this).data('idx', ui.item.data('idx'));
|
102
|
+
that._applyItemState($(this), true);
|
103
|
+
});
|
104
|
+
|
105
|
+
// workaround according to http://dev.jqueryui.com/ticket/4088
|
106
|
+
setTimeout(function() { ui.item.remove(); }, 1);
|
107
|
+
}
|
108
|
+
});
|
109
|
+
}
|
110
|
+
|
111
|
+
// set up livesearch
|
112
|
+
if (this.options.searchable) {
|
113
|
+
this._registerSearchEvents(this.availableContainer.find('input.search'));
|
114
|
+
} else {
|
115
|
+
$('.search').hide();
|
116
|
+
}
|
117
|
+
|
118
|
+
// batch actions
|
119
|
+
this.container.find(".remove-all").click(function() {
|
120
|
+
that._populateLists(that.element.find('option').removeAttr('selected'));
|
121
|
+
return false;
|
122
|
+
});
|
123
|
+
|
124
|
+
this.container.find(".add-all").click(function() {
|
125
|
+
var options = that.element.find('option').not(":selected");
|
126
|
+
if (that.availableList.children('li:hidden').length > 1) {
|
127
|
+
that.availableList.children('li').each(function(i) {
|
128
|
+
if ($(this).is(":visible")) $(options[i-1]).attr('selected', 'selected');
|
129
|
+
});
|
130
|
+
} else {
|
131
|
+
options.attr('selected', 'selected');
|
132
|
+
}
|
133
|
+
that._populateLists(that.element.find('option'));
|
134
|
+
return false;
|
135
|
+
});
|
136
|
+
},
|
137
|
+
destroy: function() {
|
138
|
+
this.element.show();
|
139
|
+
this.container.remove();
|
140
|
+
|
141
|
+
$.Widget.prototype.destroy.apply(this, arguments);
|
142
|
+
},
|
143
|
+
_populateLists: function(options) {
|
144
|
+
this.selectedList.children('.ui-element').remove();
|
145
|
+
this.availableList.children('.ui-element').remove();
|
146
|
+
this.count = 0;
|
147
|
+
|
148
|
+
var that = this;
|
149
|
+
var items = $(options.map(function(i) {
|
150
|
+
var item = that._getOptionNode(this).appendTo(this.selected ? that.selectedList : that.availableList).show();
|
151
|
+
|
152
|
+
if (this.selected) that.count += 1;
|
153
|
+
that._applyItemState(item, this.selected);
|
154
|
+
item.data('idx', i);
|
155
|
+
return item[0];
|
156
|
+
}));
|
157
|
+
|
158
|
+
// update count
|
159
|
+
this._updateCount();
|
160
|
+
that._filter.apply(this.availableContainer.find('input.search'), [that.availableList]);
|
161
|
+
},
|
162
|
+
_updateCount: function() {
|
163
|
+
this.selectedContainer.find('span.count').text(this.count+" "+$.ui.multiselect.locale.itemsCount);
|
164
|
+
},
|
165
|
+
_getOptionNode: function(option) {
|
166
|
+
option = $(option);
|
167
|
+
var node = $('<li class="ui-state-default ui-element" title="'+option.text()+'"><span class="ui-icon"/>'+option.text()+'<a href="#" class="action"><span class="ui-corner-all ui-icon"/></a></li>').hide();
|
168
|
+
node.data('optionLink', option);
|
169
|
+
return node;
|
170
|
+
},
|
171
|
+
// clones an item with associated data
|
172
|
+
// didn't find a smarter away around this
|
173
|
+
_cloneWithData: function(clonee) {
|
174
|
+
var clone = clonee.clone(false,false);
|
175
|
+
clone.data('optionLink', clonee.data('optionLink'));
|
176
|
+
clone.data('idx', clonee.data('idx'));
|
177
|
+
return clone;
|
178
|
+
},
|
179
|
+
_setSelected: function(item, selected) {
|
180
|
+
item.data('optionLink').attr('selected', selected);
|
181
|
+
|
182
|
+
if (selected) {
|
183
|
+
var selectedItem = this._cloneWithData(item);
|
184
|
+
item[this.options.hide](this.options.animated, function() { $(this).remove(); });
|
185
|
+
selectedItem.appendTo(this.selectedList).hide()[this.options.show](this.options.animated);
|
186
|
+
|
187
|
+
this._applyItemState(selectedItem, true);
|
188
|
+
return selectedItem;
|
189
|
+
} else {
|
190
|
+
|
191
|
+
// look for successor based on initial option index
|
192
|
+
var items = this.availableList.find('li'), comparator = this.options.nodeComparator;
|
193
|
+
var succ = null, i = item.data('idx'), direction = comparator(item, $(items[i]));
|
194
|
+
|
195
|
+
// TODO: test needed for dynamic list populating
|
196
|
+
if ( direction ) {
|
197
|
+
while (i>=0 && i<items.length) {
|
198
|
+
direction > 0 ? i++ : i--;
|
199
|
+
if ( direction != comparator(item, $(items[i])) ) {
|
200
|
+
// going up, go back one item down, otherwise leave as is
|
201
|
+
succ = items[direction > 0 ? i : i+1];
|
202
|
+
break;
|
203
|
+
}
|
204
|
+
}
|
205
|
+
} else {
|
206
|
+
succ = items[i];
|
207
|
+
}
|
208
|
+
|
209
|
+
var availableItem = this._cloneWithData(item);
|
210
|
+
succ ? availableItem.insertBefore($(succ)) : availableItem.appendTo(this.availableList);
|
211
|
+
item[this.options.hide](this.options.animated, function() { $(this).remove(); });
|
212
|
+
availableItem.hide()[this.options.show](this.options.animated);
|
213
|
+
|
214
|
+
this._applyItemState(availableItem, false);
|
215
|
+
return availableItem;
|
216
|
+
}
|
217
|
+
},
|
218
|
+
_applyItemState: function(item, selected) {
|
219
|
+
if (selected) {
|
220
|
+
if (this.options.sortable)
|
221
|
+
item.children('span').addClass('ui-icon-arrowthick-2-n-s').removeClass('ui-helper-hidden').addClass('ui-icon');
|
222
|
+
else
|
223
|
+
item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
|
224
|
+
item.find('a.action span').addClass('ui-icon-minus').removeClass('ui-icon-plus');
|
225
|
+
this._registerRemoveEvents(item.find('a.action'));
|
226
|
+
|
227
|
+
} else {
|
228
|
+
item.children('span').removeClass('ui-icon-arrowthick-2-n-s').addClass('ui-helper-hidden').removeClass('ui-icon');
|
229
|
+
item.find('a.action span').addClass('ui-icon-plus').removeClass('ui-icon-minus');
|
230
|
+
this._registerAddEvents(item.find('a.action'));
|
231
|
+
}
|
232
|
+
|
233
|
+
this._registerDoubleClickEvents(item);
|
234
|
+
this._registerHoverEvents(item);
|
235
|
+
},
|
236
|
+
// taken from John Resig's liveUpdate script
|
237
|
+
_filter: function(list) {
|
238
|
+
var input = $(this);
|
239
|
+
var rows = list.children('li'),
|
240
|
+
cache = rows.map(function(){
|
241
|
+
|
242
|
+
return $(this).text().toLowerCase();
|
243
|
+
});
|
244
|
+
|
245
|
+
var term = $.trim(input.val().toLowerCase()), scores = [];
|
246
|
+
|
247
|
+
if (!term) {
|
248
|
+
rows.show();
|
249
|
+
} else {
|
250
|
+
rows.hide();
|
251
|
+
|
252
|
+
cache.each(function(i) {
|
253
|
+
if (this.indexOf(term)>-1) { scores.push(i); }
|
254
|
+
});
|
255
|
+
|
256
|
+
$.each(scores, function() {
|
257
|
+
$(rows[this]).show();
|
258
|
+
});
|
259
|
+
}
|
260
|
+
},
|
261
|
+
_registerDoubleClickEvents: function(elements) {
|
262
|
+
if (!this.options.doubleClickable) return;
|
263
|
+
elements.dblclick(function() {
|
264
|
+
elements.find('a.action').click();
|
265
|
+
});
|
266
|
+
},
|
267
|
+
_registerHoverEvents: function(elements) {
|
268
|
+
elements.removeClass('ui-state-hover');
|
269
|
+
elements.mouseover(function() {
|
270
|
+
$(this).addClass('ui-state-hover');
|
271
|
+
});
|
272
|
+
elements.mouseout(function() {
|
273
|
+
$(this).removeClass('ui-state-hover');
|
274
|
+
});
|
275
|
+
},
|
276
|
+
_registerAddEvents: function(elements) {
|
277
|
+
var that = this;
|
278
|
+
elements.click(function() {
|
279
|
+
var item = that._setSelected($(this).parent(), true);
|
280
|
+
that.count += 1;
|
281
|
+
that._updateCount();
|
282
|
+
return false;
|
283
|
+
});
|
284
|
+
|
285
|
+
// make draggable
|
286
|
+
if (this.options.sortable) {
|
287
|
+
elements.each(function() {
|
288
|
+
$(this).parent().draggable({
|
289
|
+
connectToSortable: that.selectedList,
|
290
|
+
helper: function() {
|
291
|
+
var selectedItem = that._cloneWithData($(this)).width($(this).width() - 50);
|
292
|
+
selectedItem.width($(this).width());
|
293
|
+
return selectedItem;
|
294
|
+
},
|
295
|
+
appendTo: that.container,
|
296
|
+
containment: that.container,
|
297
|
+
revert: 'invalid'
|
298
|
+
});
|
299
|
+
});
|
300
|
+
}
|
301
|
+
},
|
302
|
+
_registerRemoveEvents: function(elements) {
|
303
|
+
var that = this;
|
304
|
+
elements.click(function() {
|
305
|
+
that._setSelected($(this).parent(), false);
|
306
|
+
that.count -= 1;
|
307
|
+
that._updateCount();
|
308
|
+
return false;
|
309
|
+
});
|
310
|
+
},
|
311
|
+
_registerSearchEvents: function(input) {
|
312
|
+
var that = this;
|
313
|
+
|
314
|
+
input.focus(function() {
|
315
|
+
$(this).addClass('ui-state-active');
|
316
|
+
})
|
317
|
+
.blur(function() {
|
318
|
+
$(this).removeClass('ui-state-active');
|
319
|
+
})
|
320
|
+
.keypress(function(e) {
|
321
|
+
if (e.keyCode == 13)
|
322
|
+
return false;
|
323
|
+
})
|
324
|
+
.keyup(function() {
|
325
|
+
that._filter.apply(this, [that.availableList]);
|
326
|
+
});
|
327
|
+
}
|
328
|
+
});
|
329
|
+
|
330
|
+
$.extend($.ui.multiselect, {
|
331
|
+
locale: {
|
332
|
+
addAll:'Add all',
|
333
|
+
removeAll:'Remove all',
|
334
|
+
itemsCount:'items selected'
|
335
|
+
}
|
336
|
+
});
|
337
|
+
|
338
|
+
|
339
|
+
})(jQuery);
|
@@ -0,0 +1,227 @@
|
|
1
|
+
body {
|
2
|
+
|
3
|
+
}
|
4
|
+
|
5
|
+
/* base typography */
|
6
|
+
|
7
|
+
.carrier_wrapper {
|
8
|
+
font-family:Tahoma, Arial, Helvetica, sans-serif;
|
9
|
+
font-size:0.85em;
|
10
|
+
line-height:140%;
|
11
|
+
}
|
12
|
+
.carrier_credits {
|
13
|
+
font-family:Tahoma, Arial, Helvetica, sans-serif;
|
14
|
+
font-size:0.7em;
|
15
|
+
line-height:140%;
|
16
|
+
}
|
17
|
+
|
18
|
+
.carrier_wrapper h1,
|
19
|
+
.carrier_wrapper h2,
|
20
|
+
.carrier_wrapper h3 {
|
21
|
+
font-family:Georgia;
|
22
|
+
font-weight:normal;
|
23
|
+
color:#000;
|
24
|
+
}
|
25
|
+
.carrier_wrapper h1 {
|
26
|
+
font-size:3em;
|
27
|
+
line-height:100%;
|
28
|
+
font-style:italic;
|
29
|
+
}
|
30
|
+
.carrier_wrapper h2 {
|
31
|
+
font-size:2em;
|
32
|
+
line-height:100%;
|
33
|
+
font-style:italic;
|
34
|
+
}
|
35
|
+
.carrier_wrapper h3 {
|
36
|
+
font-size:1.6em;
|
37
|
+
line-height:100%;
|
38
|
+
font-style:italic;
|
39
|
+
}
|
40
|
+
|
41
|
+
a, a:link, a:visited {text-decoration:none;}
|
42
|
+
|
43
|
+
/* structure */
|
44
|
+
|
45
|
+
.carrier_wrapper {
|
46
|
+
width:80%;
|
47
|
+
margin:0 auto;
|
48
|
+
min-height:400px;
|
49
|
+
}
|
50
|
+
|
51
|
+
.carrier_nav_line {
|
52
|
+
background-color:#ddd;
|
53
|
+
padding:10px 30px;
|
54
|
+
border-radius: 6px;
|
55
|
+
-moz-border-radius: 6px;
|
56
|
+
-webkit-border-radius: 6px;
|
57
|
+
padding-bottom:6px;
|
58
|
+
margin-bottom:10px;
|
59
|
+
}
|
60
|
+
.carrier_nav_line_inner {
|
61
|
+
//margin-bottom:-18px;
|
62
|
+
}
|
63
|
+
.carrier_new,
|
64
|
+
.carrier_nav {
|
65
|
+
display:inline-block;
|
66
|
+
}
|
67
|
+
.carrier_new a {
|
68
|
+
display:inline-block;
|
69
|
+
padding:10px 12px;
|
70
|
+
border-radius: 6px;
|
71
|
+
-moz-border-radius: 6px;
|
72
|
+
-webkit-border-radius: 6px;
|
73
|
+
color:#fff;
|
74
|
+
background-color:#333;
|
75
|
+
font-weight:bold;
|
76
|
+
}
|
77
|
+
.carrier_new a:hover {
|
78
|
+
color:#000;
|
79
|
+
background-color:#fff;
|
80
|
+
}
|
81
|
+
|
82
|
+
.carrier_nav {
|
83
|
+
margin:0 10px;
|
84
|
+
}
|
85
|
+
.carrier_nav ul { margin:0; padding:0;}
|
86
|
+
.carrier_nav li{ list-style:none; list-style-type:none; display:inline-block;}
|
87
|
+
.carrier_nav li a {
|
88
|
+
display:inline-block;
|
89
|
+
padding:10px 12px;
|
90
|
+
border-radius: 6px;
|
91
|
+
-moz-border-radius: 6px;
|
92
|
+
-webkit-border-radius: 6px;
|
93
|
+
color:#fff;
|
94
|
+
background-color:#333;
|
95
|
+
}
|
96
|
+
.carrier_nav li a:hover {
|
97
|
+
color:#000;
|
98
|
+
background-color:#fff;
|
99
|
+
}
|
100
|
+
.carrier_nav li.active a,
|
101
|
+
.carrier_new a.active {
|
102
|
+
color:#000;
|
103
|
+
background-color:#fff;
|
104
|
+
padding-bottom:22px;
|
105
|
+
margin-bottom:-18px;
|
106
|
+
}
|
107
|
+
|
108
|
+
.carrier_messagelist {clear:both; margin-top:10px;}
|
109
|
+
|
110
|
+
.message_ma_wrapper {
|
111
|
+
padding:12px;
|
112
|
+
display:block;
|
113
|
+
border-radius: 6px;
|
114
|
+
-moz-border-radius: 6px;
|
115
|
+
-webkit-border-radius: 6px;
|
116
|
+
background-color:#ddd;
|
117
|
+
margin-bottom:4px;
|
118
|
+
color:#000;
|
119
|
+
}
|
120
|
+
.message_ma_wrapper:link, .message_ma_wrapper:visited {
|
121
|
+
background-color:#ddd;
|
122
|
+
color:#000;
|
123
|
+
}
|
124
|
+
.message_ma_wrapper.ma_has_new {background-color:#eee; border:1px solid #ddd;}
|
125
|
+
.message_ma_wrapper:hover,
|
126
|
+
.message_ma_wrapper.ma_open {
|
127
|
+
background-color:#fff;
|
128
|
+
border:1px solid #ddd;
|
129
|
+
color:#000;
|
130
|
+
}
|
131
|
+
|
132
|
+
.ma_wrapper {
|
133
|
+
padding:10px 40px;
|
134
|
+
border-radius: 6px;
|
135
|
+
-moz-border-radius: 6px;
|
136
|
+
-webkit-border-radius: 6px;
|
137
|
+
background-color:#eee;
|
138
|
+
color:#000;}
|
139
|
+
.ma_wrapper a {
|
140
|
+
display:inline-block;
|
141
|
+
padding:2px 6px;
|
142
|
+
border-radius: 6px;
|
143
|
+
-moz-border-radius: 6px;
|
144
|
+
-webkit-border-radius: 6px;}
|
145
|
+
.ma_wrapper a:link, .ma_wrapper a:visited {
|
146
|
+
background-color:#ddd;
|
147
|
+
color:#000;
|
148
|
+
}
|
149
|
+
.ma_wrapper a:hover {
|
150
|
+
background-color:#fff;
|
151
|
+
color:#000;
|
152
|
+
}
|
153
|
+
|
154
|
+
|
155
|
+
.message_ma_users ,
|
156
|
+
.message_ma_branch ,
|
157
|
+
.message_ma_body {display:inline-block; margin-right:12px;}
|
158
|
+
|
159
|
+
.message_ma_date {font-size:.7em; float:right;}
|
160
|
+
.message_ma_users {}
|
161
|
+
.message_ma_user { color:#008080; font-weight:bold;}
|
162
|
+
.message_ma_branch {}
|
163
|
+
.message_ma_body {}
|
164
|
+
|
165
|
+
.message_ma_subj {}
|
166
|
+
|
167
|
+
span.ma_has_new { font-weight:bold;}
|
168
|
+
|
169
|
+
.message_ma_box_info {
|
170
|
+
padding:20px;
|
171
|
+
}
|
172
|
+
.message_ma_archive_chain {
|
173
|
+
float:right;
|
174
|
+
margin: 0 0 10px 10px;
|
175
|
+
}
|
176
|
+
.message_ma_archive_chain a {
|
177
|
+
display:inline-block;
|
178
|
+
padding:2px 6px;
|
179
|
+
margin: 0 0 0 10px;
|
180
|
+
border-radius: 6px;
|
181
|
+
-moz-border-radius: 6px;
|
182
|
+
-webkit-border-radius: 6px;
|
183
|
+
}
|
184
|
+
.message_ma_archive_chain a:link, .message_ma_archive_chain a:visited{
|
185
|
+
color:#fff;
|
186
|
+
background-color:#333;
|
187
|
+
}
|
188
|
+
.message_ma_archive_chain a:hover {
|
189
|
+
color:#000;
|
190
|
+
background-color:#ccc;
|
191
|
+
}
|
192
|
+
|
193
|
+
.message_ma_new_wrapper {}
|
194
|
+
.message_ma_new_wrapper .message_ma_new_wrapper_2 input[type="text"],
|
195
|
+
.message_ma_new_wrapper .message_ma_new_wrapper_2 textarea {width:95%;}
|
196
|
+
|
197
|
+
.message_ma_new_wrapper .message_ma_new_wrapper_2 .actions {
|
198
|
+
margin:12px 0;
|
199
|
+
}
|
200
|
+
|
201
|
+
label {
|
202
|
+
font-family: Georgia;
|
203
|
+
font-size: 14px;
|
204
|
+
font-style: italic;
|
205
|
+
font-weight:bold;
|
206
|
+
display:inline-block;
|
207
|
+
margin:16px 0 8px 0;}
|
208
|
+
|
209
|
+
/* footer */
|
210
|
+
|
211
|
+
.carrier_credits {
|
212
|
+
width:80%;
|
213
|
+
margin:40px auto;
|
214
|
+
padding:12px;
|
215
|
+
//background-color:#ccc;
|
216
|
+
border-radius: 6px;
|
217
|
+
-moz-border-radius: 6px;
|
218
|
+
-webkit-border-radius: 6px;
|
219
|
+
border-top:1px solid #ccc;
|
220
|
+
}
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
/* colors */
|
225
|
+
|
226
|
+
.red {color:Red;}
|
227
|
+
.carrier_wrapper * a:link, .carrier_wrapper * a:visited {}
|