whowish_word 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -5
- data/.loadpath +5 -5
- data/.project +18 -17
- data/Gemfile +2 -2
- data/HOW_TO_BUILD_WHOWISH_HOOK.md +9 -9
- data/ISSUE.md +93 -93
- data/README.md +208 -208
- data/lib/whowish_word/action_controller/base.rb +44 -44
- data/lib/whowish_word/action_mailer/base.rb +11 -11
- data/lib/whowish_word/action_view/base.rb +70 -70
- data/lib/whowish_word/action_view/template.rb +30 -30
- data/lib/whowish_word/authentication.rb +13 -13
- data/lib/whowish_word/config.rb +21 -21
- data/lib/whowish_word/constant.rb +8 -8
- data/lib/whowish_word/db_migration/active_record/whowish_word_html.rb +14 -14
- data/lib/whowish_word/db_migration/mongoid/whowish_word_html.rb +5 -5
- data/lib/whowish_word/initializer.rb +52 -52
- data/lib/whowish_word/rails/app/controllers/whowish_word_controller.rb +60 -60
- data/lib/whowish_word/rails/app/models/active_record/whowish_word_html.rb +3 -3
- data/lib/whowish_word/rails/app/models/mongoid/whowish_word_html.rb +8 -8
- data/lib/whowish_word/rails/public/javascripts/0_jquery-1.6.4-whowish_word.js +9046 -9046
- data/lib/whowish_word/rails/public/javascripts/1_csrf_token_hook.js +9 -9
- data/lib/whowish_word/rails/public/javascripts/1_jquery.loading_button.js +66 -66
- data/lib/whowish_word/rails/public/javascripts/2_whowish_word_variables.js +33 -33
- data/lib/whowish_word/rails/public/javascripts/3_whowish_word_dialog.js +136 -136
- data/lib/whowish_word/rails/public/javascripts/3_whowish_word_helper.js +116 -116
- data/lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js +69 -69
- data/lib/whowish_word/whowish_word.rb +41 -41
- data/lib/whowish_word/word_for.rb +93 -93
- data/rails/Gemfile +18 -18
- data/rails/Gemfile.lock +63 -64
- data/rails/app/controllers/application_controller.rb +22 -22
- data/rails/app/controllers/home_controller.rb +8 -8
- data/rails/app/views/home/index.html.erb +109 -109
- data/rails/app/views/home/static_edit.html.erb +50 -50
- data/rails/app/views/home/static_edit_select.html.erb +8 -8
- data/rails/app/views/integration/attr.html.erb +1 -1
- data/rails/app/views/integration/index.html.erb +1 -1
- data/rails/app/views/integration/select.html.erb +3 -3
- data/rails/app/views/integration/value.html.erb +1 -1
- data/rails/app/views/layouts/integration.html.erb +14 -14
- data/rails/app/views/layouts/main.html.erb +13 -13
- data/rails/app/views/layouts/nested_test_word_for.html.erb +17 -17
- data/rails/app/views/layouts/test_javascript.html.erb +13 -13
- data/rails/app/views/layouts/test_word_for.html.erb +24 -24
- data/rails/app/views/test_javascript/change_value.html.erb +32 -32
- data/rails/app/views/test_javascript/index.html.erb +87 -87
- data/rails/app/views/test_javascript/replace_with_html.html.erb +96 -96
- data/rails/app/views/test_word_for/_partial.html.erb +4 -4
- data/rails/app/views/test_word_for/index.html.erb +8 -8
- data/rails/config/application.rb +30 -30
- data/rails/config/boot.rb +9 -9
- data/rails/config/database.yml +24 -24
- data/rails/config/environment.rb +16 -16
- data/rails/config/initializers/whowish_word.rb +3 -3
- data/rails/config/mongoid.rb +6 -6
- data/rails/config/mongoid.yml +14 -14
- data/rails/config/routes.rb +7 -7
- data/rails/config.ru +4 -4
- data/rails/log/.gitignore +1 -1
- data/rails/mongo.bat +4 -4
- data/rails/public/javascripts/jquery.loading_button.js +72 -72
- data/rails/public/test/jquery_version.html +26 -26
- data/rails/script/rails +6 -6
- data/rails/spec/controllers/whowish_word_controller_spec.rb +55 -55
- data/rails/spec/integration/whowish_word_generator_spec.rb +139 -139
- data/rails/spec/integration/whowish_word_spec.rb +116 -116
- data/rails/spec/spec_helper.rb +34 -36
- data/rails/spec/support/browser.rb +193 -193
- data/rails/spec/support/json_rspec_helper.rb +8 -8
- data/rails/spec/support/mongoid_helper.rb +9 -9
- data/spec/spec_helper.rb +17 -19
- data/spec/unit/word_for_attr_in_edit_mode_spec.rb +43 -43
- data/spec/unit/word_for_attr_spec.rb +43 -43
- data/spec/unit/word_for_in_edit_mode_spec.rb +43 -43
- data/spec/unit/word_for_spec.rb +43 -43
- data/whowish_word.gemspec +21 -21
- metadata +73 -4
data/.gitignore
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
/Gemfile.lock
|
3
|
-
spec/rails/tmp/*
|
4
|
-
*.gem
|
5
|
-
rails/db/*.sqlite3
|
1
|
+
|
2
|
+
/Gemfile.lock
|
3
|
+
spec/rails/tmp/*
|
4
|
+
*.gem
|
5
|
+
rails/db/*.sqlite3
|
6
6
|
rails/tmp/*
|
data/.loadpath
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<loadpath>
|
3
|
-
<pathentry path="" type="src"/>
|
4
|
-
<pathentry path="org.rubypeople.rdt.launching.RUBY_CONTAINER" type="con"/>
|
5
|
-
</loadpath>
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<loadpath>
|
3
|
+
<pathentry path="" type="src"/>
|
4
|
+
<pathentry path="org.rubypeople.rdt.launching.RUBY_CONTAINER" type="con"/>
|
5
|
+
</loadpath>
|
data/.project
CHANGED
@@ -1,17 +1,18 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<projectDescription>
|
3
|
-
<name>whowish_word</name>
|
4
|
-
<comment></comment>
|
5
|
-
<projects>
|
6
|
-
</projects>
|
7
|
-
<buildSpec>
|
8
|
-
<buildCommand>
|
9
|
-
<name>org.rubypeople.rdt.core.rubybuilder</name>
|
10
|
-
<arguments>
|
11
|
-
</arguments>
|
12
|
-
</buildCommand>
|
13
|
-
</buildSpec>
|
14
|
-
<natures>
|
15
|
-
<nature>
|
16
|
-
|
17
|
-
</
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<projectDescription>
|
3
|
+
<name>whowish_word</name>
|
4
|
+
<comment></comment>
|
5
|
+
<projects>
|
6
|
+
</projects>
|
7
|
+
<buildSpec>
|
8
|
+
<buildCommand>
|
9
|
+
<name>org.rubypeople.rdt.core.rubybuilder</name>
|
10
|
+
<arguments>
|
11
|
+
</arguments>
|
12
|
+
</buildCommand>
|
13
|
+
</buildSpec>
|
14
|
+
<natures>
|
15
|
+
<nature>com.aptana.ruby.core.rubynature</nature>
|
16
|
+
<nature>org.rubypeople.rdt.core.rubynature</nature>
|
17
|
+
</natures>
|
18
|
+
</projectDescription>
|
data/Gemfile
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
3
|
gem 'rspec'
|
@@ -1,10 +1,10 @@
|
|
1
|
-
Process to discover where to put the hook
|
2
|
-
--------------------------------------------
|
3
|
-
|
4
|
-
In a view, please a try-catch block and print all traces.
|
5
|
-
|
6
|
-
Do this in:
|
7
|
-
1. layout
|
8
|
-
2. normal view
|
9
|
-
3. partial
|
1
|
+
Process to discover where to put the hook
|
2
|
+
--------------------------------------------
|
3
|
+
|
4
|
+
In a view, please a try-catch block and print all traces.
|
5
|
+
|
6
|
+
Do this in:
|
7
|
+
1. layout
|
8
|
+
2. normal view
|
9
|
+
3. partial
|
10
10
|
4. nested layout
|
data/ISSUE.md
CHANGED
@@ -1,93 +1,93 @@
|
|
1
|
-
Current issues
|
2
|
-
==================
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
Support different database engine
|
7
|
-
-------------------------------------------------
|
8
|
-
|
9
|
-
It is painful to use WhowishWord on different database (MySQL, PostgreSQL, MongoDB, Redis, ...).
|
10
|
-
|
11
|
-
Here is a cycle for a database
|
12
|
-
|
13
|
-
- Initialize structure
|
14
|
-
- Save migration version
|
15
|
-
- Rails uses it
|
16
|
-
- Do another migration
|
17
|
-
- Save the new version
|
18
|
-
|
19
|
-
There must be a better way that:
|
20
|
-
- lets user configure easily
|
21
|
-
- does not depend on 3rd library (No ORM. Really? Should we do that?)
|
22
|
-
- ActiveRecord is ok
|
23
|
-
- Mongoid is not, because it is not a standard
|
24
|
-
-
|
25
|
-
|
26
|
-
### Solution
|
27
|
-
|
28
|
-
Just Support them directly...
|
29
|
-
|
30
|
-
|
31
|
-
### (Not good) Solution
|
32
|
-
|
33
|
-
Use SQLite instead.
|
34
|
-
However, this poses another problem. SQLite cannot be run on Cloud service, e.g. Heroku.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
A way to activate edit mode (Solved!)
|
41
|
-
-------------------------------------------------
|
42
|
-
|
43
|
-
It should be activate-able inside Rails application, e.g. a call to WhowishWord.activate_edit_mode.
|
44
|
-
We let user manage its own session.
|
45
|
-
|
46
|
-
The thing to look out is that we have to be careful about using a global variable within WhowishWord gem
|
47
|
-
because it is shared among users....
|
48
|
-
|
49
|
-
### Solution
|
50
|
-
|
51
|
-
Create a single point of activating an edit mode, WhowishWord.activate_edit_mode()
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
Javascript text issue (Solved!)
|
56
|
-
----------------------
|
57
|
-
|
58
|
-
Javascript text being enclosed with single-quotes causes an error
|
59
|
-
(Even if we'd change to double-quotes enclosing, there would still be a problem)
|
60
|
-
|
61
|
-
|
62
|
-
### Solution 1
|
63
|
-
|
64
|
-
User is responsible to make sure that all quotes are escaped.
|
65
|
-
|
66
|
-
Input text attributes (Solved!)
|
67
|
-
----------------------
|
68
|
-
|
69
|
-
In edit mode, we cannot add edit icon next to the element, which owns the attribute.
|
70
|
-
|
71
|
-
### Solution
|
72
|
-
|
73
|
-
Use javascript to add the edit icon.
|
74
|
-
|
75
|
-
1. Generate a unique text in the attribute
|
76
|
-
2. Get the element by searching for the unique text
|
77
|
-
3. Replace text with a whowish word
|
78
|
-
4. Add edit icon to the element
|
79
|
-
|
80
|
-
When getting an element, we have to store the element and the attribute's name in a hash for future use.
|
81
|
-
This is because the element might not have its own ID.
|
82
|
-
|
83
|
-
|
84
|
-
Select box options (Solved!)
|
85
|
-
---------------------
|
86
|
-
|
87
|
-
In edit mode, we cannot edit whowish word in option's value and option's text
|
88
|
-
|
89
|
-
### Solution
|
90
|
-
|
91
|
-
Use javascript to generate edit icon
|
92
|
-
|
93
|
-
|
1
|
+
Current issues
|
2
|
+
==================
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
Support different database engine
|
7
|
+
-------------------------------------------------
|
8
|
+
|
9
|
+
It is painful to use WhowishWord on different database (MySQL, PostgreSQL, MongoDB, Redis, ...).
|
10
|
+
|
11
|
+
Here is a cycle for a database
|
12
|
+
|
13
|
+
- Initialize structure
|
14
|
+
- Save migration version
|
15
|
+
- Rails uses it
|
16
|
+
- Do another migration
|
17
|
+
- Save the new version
|
18
|
+
|
19
|
+
There must be a better way that:
|
20
|
+
- lets user configure easily
|
21
|
+
- does not depend on 3rd library (No ORM. Really? Should we do that?)
|
22
|
+
- ActiveRecord is ok
|
23
|
+
- Mongoid is not, because it is not a standard
|
24
|
+
-
|
25
|
+
|
26
|
+
### Solution
|
27
|
+
|
28
|
+
Just Support them directly...
|
29
|
+
|
30
|
+
|
31
|
+
### (Not good) Solution
|
32
|
+
|
33
|
+
Use SQLite instead.
|
34
|
+
However, this poses another problem. SQLite cannot be run on Cloud service, e.g. Heroku.
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
A way to activate edit mode (Solved!)
|
41
|
+
-------------------------------------------------
|
42
|
+
|
43
|
+
It should be activate-able inside Rails application, e.g. a call to WhowishWord.activate_edit_mode.
|
44
|
+
We let user manage its own session.
|
45
|
+
|
46
|
+
The thing to look out is that we have to be careful about using a global variable within WhowishWord gem
|
47
|
+
because it is shared among users....
|
48
|
+
|
49
|
+
### Solution
|
50
|
+
|
51
|
+
Create a single point of activating an edit mode, WhowishWord.activate_edit_mode()
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
Javascript text issue (Solved!)
|
56
|
+
----------------------
|
57
|
+
|
58
|
+
Javascript text being enclosed with single-quotes causes an error
|
59
|
+
(Even if we'd change to double-quotes enclosing, there would still be a problem)
|
60
|
+
|
61
|
+
|
62
|
+
### Solution 1
|
63
|
+
|
64
|
+
User is responsible to make sure that all quotes are escaped.
|
65
|
+
|
66
|
+
Input text attributes (Solved!)
|
67
|
+
----------------------
|
68
|
+
|
69
|
+
In edit mode, we cannot add edit icon next to the element, which owns the attribute.
|
70
|
+
|
71
|
+
### Solution
|
72
|
+
|
73
|
+
Use javascript to add the edit icon.
|
74
|
+
|
75
|
+
1. Generate a unique text in the attribute
|
76
|
+
2. Get the element by searching for the unique text
|
77
|
+
3. Replace text with a whowish word
|
78
|
+
4. Add edit icon to the element
|
79
|
+
|
80
|
+
When getting an element, we have to store the element and the attribute's name in a hash for future use.
|
81
|
+
This is because the element might not have its own ID.
|
82
|
+
|
83
|
+
|
84
|
+
Select box options (Solved!)
|
85
|
+
---------------------
|
86
|
+
|
87
|
+
In edit mode, we cannot edit whowish word in option's value and option's text
|
88
|
+
|
89
|
+
### Solution
|
90
|
+
|
91
|
+
Use javascript to generate edit icon
|
92
|
+
|
93
|
+
|