openskip-skip_embedded 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.9.4 / 2009-05-22
2
+ * [new] update flash showing mechanism.
3
+
1
4
  == 0.9.3 / 2009-05-22
2
5
  * [new] 'skip_embedded_stylesheets' generator. extracted from main generator.
3
6
  * [new] client library for SKIP RP services(wiki, etc..).
data/Rakefile CHANGED
@@ -60,7 +60,7 @@ spec = Gem::Specification.new do |s|
60
60
  s.require_path = "lib"
61
61
  s.test_files = Dir["spec/**/*_spec.rb"]
62
62
 
63
- s.add_dependency "moro-repim", ">=0.1.4"
63
+ s.add_dependency "moro-repim", ">=0.1.7"
64
64
  s.add_dependency "json"
65
65
  s.add_dependency "oauth"
66
66
 
@@ -11,6 +11,7 @@ class SkipEmbeddedGenerator < Rails::Generator::Base
11
11
  public/javascripts/dropdown_navigation.js
12
12
  public/javascripts/labeled_text_field.js
13
13
  public/javascripts/skip_fckeditor_config.js
14
+ public/javascripts/flash_message.js
14
15
  ]
15
16
 
16
17
  assets.map{|asset| File.dirname(asset) }.uniq.each{|asset| m.directory(asset) }
@@ -35,8 +35,8 @@
35
35
  <% if SkipEmbedded::InitialSettings["skip_collaboration"]["fulltext_search"] -%>
36
36
  <%= render(:partial => "shared/skip_full_text_search_form") %>
37
37
  <% end -%>
38
- <%= render :partial=>"shared/flash_message" %>
39
38
  </div>
39
+ <%= render :partial=>"shared/flash_message" %>
40
40
 
41
41
  <div id="main">
42
42
  <div id="tab_body">
@@ -1,27 +1,16 @@
1
+
1
2
  <div id="flash_message">
2
- <%= render_flash(:error) %>
3
- <%= render_flash(:warn) %>
4
- <%= render_flash(:notice) %>
3
+ <% %w[error warn notice].each do |klass| -%>
4
+ <% content_tag(:div, :class => klass, :style => "display:none") do -%>
5
+ <%= content_tag("h3", "&nbsp;")%>
6
+ <%= content_tag("span", _("[Click to hide]")) %>
7
+ <%end -%>
8
+ <% end -%>
5
9
  </div>
6
10
 
7
- <%- javascript_tag do %>
8
- jQuery(document).ready(function(){
9
- $("#flash_message div").click(function(){$('#ie-select-fix').remove(); $(this).fadeOut("slow")});
10
- setTimeout(function(){ $("#flash_message div.notice").trigger("click"); }, 2*1000);
11
- setTimeout(function(){ $("#flash_message div.warn").trigger("click"); }, 5*1000);
12
-
13
- if(jQuery.browser.ie){
14
- var flash = jQuery("#flash_message");
15
- var position = flash.position();
16
-
17
- var iframe = jQuery("<iframe id='ie-select-fix' src='<%= request.relative_url_root + "/blank" %>'></iframe>").
18
- css("z-index", flash.css("z-index")).
19
- css("width", flash.width()).
20
- css("height", flash.height()).
21
- css("top", position.top).
22
- css("left", position.left);
23
-
24
- flash.css("z-index", Number(iframe.css("z-index")) + 1).after(iframe);
25
- };
26
- });
11
+ <%- content_for :javascript_initializer do %>
12
+ $("#flash_message").flashMessage(
13
+ <%= [:error, :warn, :notice].inject({}){|r, k| r.update(k => flash[k]) }.reject{|k,v|v.nil?}.to_json %>,
14
+ "<%= request.relative_url_root %>"
15
+ );
27
16
  <% end %>
@@ -0,0 +1,39 @@
1
+ jQuery.fn.flashMessage = function(flashes, relativeUrlRoot){
2
+ var flash = jQuery(this);
3
+ if(jQuery.browser.ie){
4
+ var position = flash.position();
5
+
6
+ var iframe = jQuery("<iframe id='ie-select-fix'></iframe>").
7
+ attr("src", relativeUrlRoot + "/blank").
8
+ css("z-index", flash.css("z-index")).
9
+ css("width", flash.width()).
10
+ css("height", flash.height()).
11
+ css("top", position.top).
12
+ css("left", position.left);
13
+
14
+ flash.css("z-index", Number(iframe.css("z-index")) + 1).after(iframe);
15
+ };
16
+
17
+ flash.find(" > div").click(function(){
18
+ jQuery("#ie-select-fix").hide();
19
+ jQuery(this).fadeOut();
20
+ });
21
+
22
+ function showFlash(type, message, hideAfterSec){
23
+ jQuery("#ie-select-fix").show();
24
+ flash.find("div." + type).show().find("h3").text(message);
25
+ if(hideAfterSec){
26
+ setTimeout(function(){ flash.find("div." + type).trigger("click"); }, hideAfterSec * 1000);
27
+ };
28
+ };
29
+
30
+ flash.bind("error", function(_,message){ showFlash("error", message) }).
31
+ bind("warn", function(_,message){ showFlash("warn", message, 5) }).
32
+ bind("notice", function(_,message){ showFlash("notice", message, 2) });
33
+
34
+ jQuery.each(flashes, function(key,val){ flash.triggerHandler(key, val) });
35
+
36
+ return flash;
37
+ };
38
+
39
+
data/lib/skip_embedded.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # SkipEmbedded
2
2
  module SkipEmbedded
3
- Version = "0.9.3"
3
+ Version = "0.9.4"
4
4
 
5
5
  Dependencies = {:jquery => "jquery-1.3.2.min.js"}
6
6
  end
@@ -5,7 +5,7 @@ module SkipEmbedded
5
5
 
6
6
  def self.included(base)
7
7
  ActionView::Helpers::AssetTagHelper.register_javascript_expansion :jquery => [Dependencies[:jquery]]
8
- ActionView::Helpers::AssetTagHelper.register_javascript_expansion :skip => %w[dropdown_navigation labeled_text_field]
8
+ ActionView::Helpers::AssetTagHelper.register_javascript_expansion :skip => %w[dropdown_navigation labeled_text_field flash_message]
9
9
  ActionView::Helpers::AssetTagHelper.register_javascript_expansion :skip_fckeditor => %w[fckeditor/fckeditor skip_fckeditor_config]
10
10
 
11
11
  # TODO skip/style などをどの程度共通化するかを検討、それはではskip_embeddedという別名で
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openskip-skip_embedded
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - MAEDA Naoki
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 0.1.4
24
+ version: 0.1.7
25
25
  version:
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: json
@@ -101,6 +101,7 @@ files:
101
101
  - generators/skip_embedded/templates/public/blank.html
102
102
  - generators/skip_embedded/templates/public/javascripts
103
103
  - generators/skip_embedded/templates/public/javascripts/dropdown_navigation.js
104
+ - generators/skip_embedded/templates/public/javascripts/flash_message.js
104
105
  - generators/skip_embedded/templates/public/javascripts/labeled_text_field.js
105
106
  - generators/skip_embedded/templates/public/javascripts/skip_fckeditor_config.js
106
107
  - generators/skip_embedded_stylesheets