poe_rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/poe_rails/cheat_sheet.js +19 -2
- data/app/assets/javascripts/poe_rails/poe_pallet.js +96 -0
- data/app/controllers/poe_rails/cheat_sheet_controller.rb +6 -6
- data/app/views/poe_rails/cheat_sheet/index.html.erb +44 -28
- data/poe_rails.gemspec +2 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f38753e908c38b35fd2657011a636da29dde688
|
4
|
+
data.tar.gz: 3b5bb2f15ffce6bbf81e3f2de33d9e813bfc012f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ff4b90a540b8149ae6c76f81452dabe37ea55e32e7f1cb7c134bdb1aaf48c734acbdfe4d439940236ba00601bcf3054acf90e374813619b103731e26a6131b2
|
7
|
+
data.tar.gz: e2fd3c72956c1f3a77eb67f2c68062c7db8de25b2f70c7d2532772adb9e0ce166c6d9ecf42c693658f7a8f3475bd9e2aee14357ab66e8a6c73b1543c9ae077c8
|
@@ -1,2 +1,19 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
//$ = jQuery
|
2
|
+
|
3
|
+
//pluginName = 'poe_pallet'
|
4
|
+
//defaults = version: 0.5
|
5
|
+
|
6
|
+
var emoji_index = new Array();
|
7
|
+
function set_index(name) {
|
8
|
+
emoji_index.push(name);
|
9
|
+
}
|
10
|
+
|
11
|
+
function set_name(name) {
|
12
|
+
document.getElementById("emoji_name").value = ":" + name + ":";
|
13
|
+
}
|
14
|
+
|
15
|
+
$(document).ready(function(){
|
16
|
+
$('#tooltip').poe_pallet({
|
17
|
+
data: emoji_index
|
18
|
+
});
|
19
|
+
});
|
@@ -0,0 +1,96 @@
|
|
1
|
+
// the semi-colon before function invocation is a safety net against concatenated
|
2
|
+
// scripts and/or other plugins which may not be closed properly.
|
3
|
+
;(function ( $, window, document, undefined ) {
|
4
|
+
|
5
|
+
// undefined is used here as the undefined global variable in ECMAScript 3 is
|
6
|
+
// mutable (ie. it can be changed by someone else). undefined isn't really being
|
7
|
+
// passed in so we can ensure the value of it is truly undefined. In ES5, undefined
|
8
|
+
// can no longer be modified.
|
9
|
+
|
10
|
+
// window and document are passed through as local variable rather than global
|
11
|
+
// as this (slightly) quickens the resolution process and can be more efficiently
|
12
|
+
// minified (especially when both are regularly referenced in your plugin).
|
13
|
+
|
14
|
+
// Create the defaults once
|
15
|
+
var pluginName = "poe_pallet",
|
16
|
+
defaults = {
|
17
|
+
version: 0.5
|
18
|
+
};
|
19
|
+
|
20
|
+
// The actual plugin constructor
|
21
|
+
function Plugin( element, options ) {
|
22
|
+
this.element = element;
|
23
|
+
|
24
|
+
// jQuery has an extend method which merges the contents of two or
|
25
|
+
// more objects, storing the result in the first object. The first object
|
26
|
+
// is generally empty as we don't want to alter the default options for
|
27
|
+
// future instances of the plugin
|
28
|
+
this.options = $.extend( {}, defaults, options );
|
29
|
+
|
30
|
+
this._defaults = defaults;
|
31
|
+
this._name = pluginName;
|
32
|
+
|
33
|
+
this.path = "/assets/poe/png20/";
|
34
|
+
this.pallet_html = "";
|
35
|
+
|
36
|
+
this.init();
|
37
|
+
}
|
38
|
+
|
39
|
+
Plugin.prototype = {
|
40
|
+
|
41
|
+
init: function() {
|
42
|
+
// Place initialization logic here
|
43
|
+
// You already have access to the DOM element and
|
44
|
+
// the options via the instance, e.g. this.element
|
45
|
+
// and this.options
|
46
|
+
// you can add more functions like the one below and
|
47
|
+
// call them like so: this.yourOtherFunction(this.element, this.options).
|
48
|
+
|
49
|
+
//this.printElement(this.element);
|
50
|
+
this.create_pallet(this.options.data, this.path);
|
51
|
+
this.set_pallet_element(this.pallet_html);
|
52
|
+
},
|
53
|
+
|
54
|
+
printElement: function(el, options) {
|
55
|
+
// some logic
|
56
|
+
console.log(el);
|
57
|
+
},
|
58
|
+
|
59
|
+
create_pallet: function(emoji_index, path) {
|
60
|
+
var parts_start = "<div>";
|
61
|
+
var parts_end = "</div>";
|
62
|
+
var pallet_html = parts_start;
|
63
|
+
|
64
|
+
for (i = 0; i < emoji_index.length; i++) {
|
65
|
+
pallet_html += "<input type='image' src='" + path + emoji_index[i] +
|
66
|
+
".png' onclick='set_name(" + '"'+ emoji_index[i] + '"' + ")'>";
|
67
|
+
if (i < emoji_index.size - 1) {
|
68
|
+
pallet_html += parts_end;
|
69
|
+
} else if (i % 10 == 9) {
|
70
|
+
pallet_html += parts_end;
|
71
|
+
pallet_html += parts_start;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
this.pallet_html = pallet_html;
|
75
|
+
},
|
76
|
+
|
77
|
+
set_pallet_element: function(pallet_html) {
|
78
|
+
$('#tooltip').popover({
|
79
|
+
trigger:'click',
|
80
|
+
content:pallet_html
|
81
|
+
});
|
82
|
+
}
|
83
|
+
|
84
|
+
};
|
85
|
+
|
86
|
+
// A really lightweight plugin wrapper around the constructor,
|
87
|
+
// preventing against multiple instantiations
|
88
|
+
$.fn[pluginName] = function ( options ) {
|
89
|
+
return this.each(function () {
|
90
|
+
if (!$.data(this, "plugin_" + pluginName)) {
|
91
|
+
$.data(this, "plugin_" + pluginName, new Plugin( this, options ));
|
92
|
+
}
|
93
|
+
});
|
94
|
+
};
|
95
|
+
|
96
|
+
})( jQuery, window, document );
|
@@ -9,23 +9,23 @@ module PoeRails
|
|
9
9
|
@index = @poe.instance_variable_get("@index")
|
10
10
|
@path = '/assets/poe/png64/'
|
11
11
|
|
12
|
-
|
12
|
+
set_categories
|
13
13
|
set_divided_emojis
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
@
|
16
|
+
def set_categories
|
17
|
+
@categories = Array.new
|
18
18
|
@index.each do |item|
|
19
|
-
@
|
19
|
+
@categories << item['category'] if !@categories.include?(item['category'])
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
def set_divided_emojis
|
24
24
|
@divided_emojis = Array.new
|
25
|
-
@
|
25
|
+
@categories.each do |category|
|
26
26
|
emojis = Array.new
|
27
27
|
@index.each do |emoji|
|
28
|
-
if
|
28
|
+
if category == emoji['category']
|
29
29
|
emojis << emoji
|
30
30
|
end
|
31
31
|
end
|
@@ -1,42 +1,58 @@
|
|
1
|
+
<script>
|
2
|
+
<% for i in 0..@categories.size - 1 %>
|
3
|
+
<% @divided_emojis[i].each do |item| %>
|
4
|
+
set_index('<%= item['name'] %>')
|
5
|
+
<% end %>
|
6
|
+
<% end %>
|
7
|
+
</script>
|
8
|
+
|
1
9
|
<div class="container">
|
2
10
|
<div class="row-fluid">
|
3
11
|
<div class="span12">
|
4
|
-
<
|
12
|
+
<div class="row-fluid">
|
13
|
+
<h2 class="text-center">Phantom Open Emoji Cheat Sheet</h2>
|
14
|
+
</div>
|
5
15
|
<hr style="border-style:solid;">
|
6
|
-
<ul class="unstyled">
|
7
16
|
|
8
|
-
|
9
|
-
|
17
|
+
<div class="row-fluid text-center">
|
18
|
+
<input type="text" id="emoji_name">
|
19
|
+
<input type="image" id="tooltip" src="/assets/poe/png20/grinning.png"
|
20
|
+
data-html="true" data-ttoggle="popover" data-placement="bottom" data-animation="false">
|
21
|
+
</div>
|
10
22
|
|
11
|
-
|
12
|
-
|
13
|
-
<div class="span6">
|
14
|
-
<div class="span2">
|
15
|
-
<%= image_tag @path + item['name'] + '.png' %>
|
16
|
-
</div>
|
17
|
-
<div class="span10">
|
18
|
-
<p class="icon-name">
|
19
|
-
: <%= item['name'] %>
|
20
|
-
</p>
|
21
|
-
</div>
|
22
|
-
</div>
|
23
|
+
<div class="row-fluid">
|
24
|
+
<div class="span12">
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<%
|
26
|
+
<% @categories.each_with_index do |category, i| %>
|
27
|
+
<div class="row-fluid">
|
28
|
+
<h3><%= category %></h3>
|
29
|
+
</div>
|
30
|
+
<div class="row-fluid">
|
31
|
+
|
32
|
+
<% @divided_emojis[i].each_with_index do |item, j| %>
|
33
|
+
<% if j % 2 == 0 and j != 0 %>
|
34
|
+
</div>
|
35
|
+
<div class="row-fluid mt-l">
|
36
|
+
<% end %>
|
37
|
+
<div class="span6">
|
38
|
+
<div class="span2">
|
39
|
+
<%= image_tag @path + item['name'] + '.png' %>
|
40
|
+
</div>
|
41
|
+
<div class="span10">
|
42
|
+
<p class="icon-name">
|
43
|
+
:<%= item['name'] %>:
|
44
|
+
</p>
|
45
|
+
</div>
|
31
46
|
</div>
|
32
|
-
<div class="row-fluid mt-l">
|
33
47
|
<% end %>
|
34
48
|
|
35
|
-
|
36
|
-
|
37
|
-
|
49
|
+
</div>
|
50
|
+
<hr style="border-style:dashed;">
|
51
|
+
<% end %>
|
38
52
|
|
39
|
-
|
53
|
+
<hr style="border-style:solid;">
|
54
|
+
</div>
|
55
|
+
</div>
|
40
56
|
</div>
|
41
57
|
</div>
|
42
58
|
</div>
|
data/poe_rails.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'poe_rails'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.4'
|
4
4
|
s.license = 'GNU GPLv3 and AGPLv3'
|
5
5
|
s.authors = ['Yukiharu Nakaya', 'Rika Yoshida', 'Rei Kagetsuki']
|
6
6
|
s.email = 'info@genshin.org'
|
@@ -12,5 +12,5 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.add_dependency 'highline'
|
14
14
|
s.add_dependency 'phantom_open_emoji'
|
15
|
-
s.add_dependency '
|
15
|
+
s.add_dependency 'poe_static'
|
16
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poe_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukiharu Nakaya
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-06-03 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: highline
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
|
-
name:
|
44
|
+
name: poe_static
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - '>='
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- app/assets/javascripts/poe_rails/application.js
|
71
71
|
- app/assets/javascripts/poe_rails/bootstrap.min.js
|
72
72
|
- app/assets/javascripts/poe_rails/cheat_sheet.js
|
73
|
+
- app/assets/javascripts/poe_rails/poe_pallet.js
|
73
74
|
- app/assets/stylesheets/poe_rails/application.css
|
74
75
|
- app/assets/stylesheets/poe_rails/bootstrap-responsive.min.css
|
75
76
|
- app/assets/stylesheets/poe_rails/bootstrap.min.css
|