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 +3 -0
- data/Rakefile +1 -1
- data/generators/skip_embedded/skip_embedded_generator.rb +1 -0
- data/generators/skip_embedded/templates/app/views/layouts/skip_embedded.html.erb +1 -1
- data/generators/skip_embedded/templates/app/views/shared/_flash_message.html.erb +12 -23
- data/generators/skip_embedded/templates/public/javascripts/flash_message.js +39 -0
- data/lib/skip_embedded.rb +1 -1
- data/lib/skip_embedded/helpers.rb +1 -1
- metadata +3 -2
data/ChangeLog
CHANGED
data/Rakefile
CHANGED
@@ -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
|
-
|
3
|
-
|
4
|
-
|
3
|
+
<% %w[error warn notice].each do |klass| -%>
|
4
|
+
<% content_tag(:div, :class => klass, :style => "display:none") do -%>
|
5
|
+
<%= content_tag("h3", " ")%>
|
6
|
+
<%= content_tag("span", _("[Click to hide]")) %>
|
7
|
+
<%end -%>
|
8
|
+
<% end -%>
|
5
9
|
</div>
|
6
10
|
|
7
|
-
<%-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
@@ -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.
|
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.
|
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
|