whowish_word 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/README.md +4 -3
  2. data/lib/whowish_word/initializer.rb +2 -4
  3. data/lib/whowish_word/rails/app/controllers/whowish_word_controller.rb +0 -10
  4. data/rails/app/controllers/application_controller.rb +2 -0
  5. data/rails/config/initializers/whowish_word.rb +0 -2
  6. data/rails/spec/integration/whowish_word_spec.rb +7 -0
  7. data/rails/spec/spec_helper.rb +0 -8
  8. data/whowish_word.gemspec +1 -1
  9. metadata +1 -25
  10. data/lib/legacy/whowish_word/config.rb +0 -1
  11. data/lib/legacy/whowish_word/init.rb +0 -4
  12. data/lib/legacy/whowish_word/lib/app/controllers/whowish_word_controller.rb +0 -115
  13. data/lib/legacy/whowish_word/lib/app/controllers/whowish_word_email_controller.rb +0 -66
  14. data/lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb +0 -62
  15. data/lib/legacy/whowish_word/lib/app/models/mongodb/whowish_word.rb +0 -12
  16. data/lib/legacy/whowish_word/lib/app/models/mongodb/whowish_word_email.rb +0 -10
  17. data/lib/legacy/whowish_word/lib/app/models/mongodb/whowish_word_facebook.rb +0 -28
  18. data/lib/legacy/whowish_word/lib/app/models/mysql/whowish_word.rb +0 -5
  19. data/lib/legacy/whowish_word/lib/app/models/mysql/whowish_word_email.rb +0 -5
  20. data/lib/legacy/whowish_word/lib/app/models/mysql/whowish_word_facebook.rb +0 -18
  21. data/lib/legacy/whowish_word/lib/app/views/layouts/whowish_word_blank.html.erb +0 -94
  22. data/lib/legacy/whowish_word/lib/app/views/whowish_word/_javascript.html.erb +0 -82
  23. data/lib/legacy/whowish_word/lib/app/views/whowish_word/_row.html.erb +0 -50
  24. data/lib/legacy/whowish_word/lib/app/views/whowish_word/index.html.erb +0 -219
  25. data/lib/legacy/whowish_word/lib/app/views/whowish_word/login.html.erb +0 -5
  26. data/lib/legacy/whowish_word/lib/app/views/whowish_word_email/_row.html.erb +0 -42
  27. data/lib/legacy/whowish_word/lib/app/views/whowish_word_email/index.html.erb +0 -99
  28. data/lib/legacy/whowish_word/lib/app/views/whowish_word_facebook/_row.html.erb +0 -48
  29. data/lib/legacy/whowish_word/lib/app/views/whowish_word_facebook/index.html.erb +0 -100
  30. data/lib/legacy/whowish_word/lib/db_migration/mongodb.rb +0 -0
  31. data/lib/legacy/whowish_word/lib/db_migration/mysql.rb +0 -60
  32. data/lib/legacy/whowish_word/lib/db_migration.rb +0 -2
  33. data/lib/legacy/whowish_word/lib/hook.rb +0 -186
data/README.md CHANGED
@@ -3,6 +3,8 @@ WhowishWord - a Rails gem that make static content editable
3
3
 
4
4
  WhowishWord makes static content editable, as long as the programmers follow its convention.
5
5
 
6
+ Demo: http://whowish-word.heroku.com
7
+
6
8
 
7
9
  The problem WhowishWord tries to solve
8
10
  ---------------------------------------
@@ -23,6 +25,8 @@ The beauty of WhowishWord is that:
23
25
  * Programmers don't have to care how wording should be. This makes them work much faster
24
26
  * It does not clutter up your source code because you replace one static content unit with one function call
25
27
 
28
+ Demo: http://whowish-word.heroku.com
29
+
26
30
 
27
31
  How you should work
28
32
  -------------------
@@ -54,7 +58,6 @@ activate_whowish_word_edit_mode()
54
58
  2. You'll see an edit icon on each word
55
59
  3. Click on an edit icon to edit the corresponding word
56
60
  4. Fill in a new word, and click save
57
- * If it is the first time, you will need to fill master password at this point. (The instruction how to set password is in 'How to use it' section)
58
61
 
59
62
  And when you have finished, deactivate edit mode.
60
63
 
@@ -118,8 +121,6 @@ require 'whowish_word'
118
121
 
119
122
  WhowishWord.init(:active_record)
120
123
 
121
- WhowishWord.username = "root"
122
- WhowishWord.password = "pass"
123
124
  ```
124
125
 
125
126
  You can use either use :active_record or :mongoid
@@ -22,8 +22,6 @@ module WhowishWord
22
22
 
23
23
  def install_hook
24
24
 
25
-
26
-
27
25
  Dir[File.expand_path("../action_controller/**/*.rb", __FILE__)].each {|f| require f}
28
26
  Dir[File.expand_path("../action_mailer/**/*.rb", __FILE__)].each {|f| require f}
29
27
  Dir[File.expand_path("../action_view/**/*.rb", __FILE__)].each {|f| require f}
@@ -33,7 +31,7 @@ module WhowishWord
33
31
 
34
32
  def load_rails
35
33
 
36
- paths = ["controllers","views","models/#{@orm_engine}"]
34
+ paths = ["controllers","models/#{@orm_engine}"]
37
35
 
38
36
  # load all controllers, helpers, and models
39
37
  paths.each do |dir|
@@ -46,7 +44,7 @@ module WhowishWord
46
44
 
47
45
  end
48
46
 
49
- ActionController::Base.append_view_path(File.join(File.dirname(__FILE__), 'rails', 'app', 'views'))
47
+ ActionController::Base.append_view_path(File.join(File.dirname(__FILE__), 'rails', 'app'))
50
48
 
51
49
  end
52
50
 
@@ -31,7 +31,6 @@ class WhowishWordController < ActionController::Base
31
31
 
32
32
  end
33
33
 
34
- before_filter :authenticate, :only => [ :change_word ]
35
34
  def change_word
36
35
 
37
36
  entity = WhowishWordHtml.first(:conditions=>{:word_id => params[:word_id].strip})
@@ -58,14 +57,5 @@ class WhowishWordController < ActionController::Base
58
57
  render :json=>{:ok=>true}
59
58
  end
60
59
 
61
- private
62
- def authenticate
63
-
64
- return if Rails.env.test?
65
-
66
- authenticate_or_request_with_http_basic do |id, password|
67
- id == WhowishWord.username && password == WhowishWord.password
68
- end
69
- end
70
60
 
71
61
  end
@@ -8,6 +8,8 @@ class ApplicationController < ActionController::Base
8
8
  if params[:edit_mode] == "yes"
9
9
  activate_whowish_word_edit_mode
10
10
  end
11
+
12
+
11
13
  end
12
14
 
13
15
 
@@ -1,5 +1,3 @@
1
1
 
2
2
  WhowishWord.init($ORM_ENGINE)
3
3
 
4
- WhowishWord.username = "root"
5
- WhowishWord.password = "pass"
@@ -5,6 +5,7 @@ describe 'WhowishWord workflow spec' do
5
5
  it "edits a normal text" do
6
6
 
7
7
  goto '/integration?edit_mode=yes'
8
+ sleep(1)
8
9
 
9
10
  click 'whowishWordId0_____html'
10
11
 
@@ -16,6 +17,7 @@ describe 'WhowishWord workflow spec' do
16
17
  commit_database
17
18
 
18
19
  goto '/integration?edit_mode=yes'
20
+ sleep(1)
19
21
 
20
22
  html('whowishWordId0').should == "Some new word"
21
23
 
@@ -27,6 +29,7 @@ describe 'WhowishWord workflow spec' do
27
29
  it "edits a value" do
28
30
 
29
31
  goto '/integration/value?edit_mode=yes'
32
+ sleep(1)
30
33
 
31
34
  click 'whowishWordId0_____value'
32
35
 
@@ -38,6 +41,7 @@ describe 'WhowishWord workflow spec' do
38
41
  commit_database
39
42
 
40
43
  goto '/integration/value?edit_mode=yes'
44
+ sleep(1)
41
45
 
42
46
  value('whowishWordId0').should == "Some new word"
43
47
 
@@ -49,6 +53,7 @@ describe 'WhowishWord workflow spec' do
49
53
  it "edits an attribute" do
50
54
 
51
55
  goto '/integration/attr?edit_mode=yes'
56
+ sleep(1)
52
57
 
53
58
  click 'whowishWordId0_____title'
54
59
 
@@ -71,6 +76,7 @@ describe 'WhowishWord workflow spec' do
71
76
  it "edits an option" do
72
77
 
73
78
  goto '/integration/select?edit_mode=yes'
79
+ sleep(1)
74
80
 
75
81
 
76
82
  click 'whowishWordId0_____value'
@@ -92,6 +98,7 @@ describe 'WhowishWord workflow spec' do
92
98
  commit_database
93
99
 
94
100
  goto '/integration/select?edit_mode=yes'
101
+ sleep(1)
95
102
 
96
103
  value('whowishWordId0').should == "Some new value"
97
104
 
@@ -21,14 +21,6 @@ RSpec.configure do |config|
21
21
  config.include MongoidHelper
22
22
  config.include JsonRspecHelper
23
23
 
24
- config.before(:suite) do
25
-
26
- class WhowishWordController
27
- def authenticate;end
28
- end
29
-
30
- end
31
-
32
24
  config.before(:each) do
33
25
 
34
26
  WhowishWordHtml.delete_all
data/whowish_word.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "whowish_word"
6
- s.version = "0.2.1"
6
+ s.version = "0.2.2"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Tanin Na Nakorn"]
9
9
  s.email = ["tanin47@yahoo.com"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whowish_word
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -25,30 +25,6 @@ files:
25
25
  - HOW_TO_BUILD_WHOWISH_HOOK.md
26
26
  - ISSUE.md
27
27
  - README.md
28
- - lib/legacy/whowish_word/config.rb
29
- - lib/legacy/whowish_word/init.rb
30
- - lib/legacy/whowish_word/lib/app/controllers/whowish_word_controller.rb
31
- - lib/legacy/whowish_word/lib/app/controllers/whowish_word_email_controller.rb
32
- - lib/legacy/whowish_word/lib/app/controllers/whowish_word_facebook_controller.rb
33
- - lib/legacy/whowish_word/lib/app/models/mongodb/whowish_word.rb
34
- - lib/legacy/whowish_word/lib/app/models/mongodb/whowish_word_email.rb
35
- - lib/legacy/whowish_word/lib/app/models/mongodb/whowish_word_facebook.rb
36
- - lib/legacy/whowish_word/lib/app/models/mysql/whowish_word.rb
37
- - lib/legacy/whowish_word/lib/app/models/mysql/whowish_word_email.rb
38
- - lib/legacy/whowish_word/lib/app/models/mysql/whowish_word_facebook.rb
39
- - lib/legacy/whowish_word/lib/app/views/layouts/whowish_word_blank.html.erb
40
- - lib/legacy/whowish_word/lib/app/views/whowish_word/_javascript.html.erb
41
- - lib/legacy/whowish_word/lib/app/views/whowish_word/_row.html.erb
42
- - lib/legacy/whowish_word/lib/app/views/whowish_word/index.html.erb
43
- - lib/legacy/whowish_word/lib/app/views/whowish_word/login.html.erb
44
- - lib/legacy/whowish_word/lib/app/views/whowish_word_email/_row.html.erb
45
- - lib/legacy/whowish_word/lib/app/views/whowish_word_email/index.html.erb
46
- - lib/legacy/whowish_word/lib/app/views/whowish_word_facebook/_row.html.erb
47
- - lib/legacy/whowish_word/lib/app/views/whowish_word_facebook/index.html.erb
48
- - lib/legacy/whowish_word/lib/db_migration.rb
49
- - lib/legacy/whowish_word/lib/db_migration/mongodb.rb
50
- - lib/legacy/whowish_word/lib/db_migration/mysql.rb
51
- - lib/legacy/whowish_word/lib/hook.rb
52
28
  - lib/whowish_word.rb
53
29
  - lib/whowish_word/action_controller/base.rb
54
30
  - lib/whowish_word/action_mailer/base.rb
@@ -1 +0,0 @@
1
- WHOWISH_WORD_DATABASE_ENGINE = "mongodb" # mongodb or mysql
@@ -1,4 +0,0 @@
1
-
2
-
3
- require File.dirname(__FILE__)+'/lib/hook'
4
- require File.dirname(__FILE__)+'/lib/db_migration'
@@ -1,115 +0,0 @@
1
- class WhowishWordController < ActionController::Base
2
- before_filter :compact_policy,:check_whowish_word_admin, :choose_locale
3
- before_filter :check_whowish_word_login, :except=>[:login,:do_login]
4
-
5
- def check_whowish_word_login
6
-
7
- render :login, :layout=>nil if session[:whowish_word_login] != "true"
8
- end
9
-
10
- def check_whowish_word_admin
11
- $whowish_word_admin = session[:whowish_word_admin]
12
- end
13
-
14
- def compact_policy
15
- response.headers['P3P'] = 'policyref="/w3c/p3p.xml", CP="'+COMPACT_POLICY+'"'
16
- end
17
-
18
- layout "whowish_word_blank"
19
-
20
- def do_login
21
- if params[:password] == "whowish#456"
22
- session[:whowish_word_login] = "true"
23
- index
24
- render :index
25
- else
26
- @error = "The password is invalid."
27
- render :login, :layout=>"blank"
28
- end
29
- end
30
-
31
- def logout
32
- session[:whowish_word_login] = nil
33
- render :login, :layout=>"blank"
34
- end
35
-
36
- def activate
37
- if params[:enabled]=="yes"
38
- session[:whowish_word_admin] = true
39
- else
40
- session[:whowish_word_admin] = false
41
- end
42
-
43
- render :json=>{:ok=>true}
44
- end
45
-
46
-
47
- SHOW_FIELDS = [
48
- {:id=>"word_id",:width=>300},
49
- {:id=>"content",:type=>"textarea",:width=>350}]
50
-
51
- def index
52
- @fs = SHOW_FIELDS
53
- end
54
-
55
- def get_word
56
- logger.debug { "locale=#{$locale}"}
57
- entity = WhowishWord.first(:conditions=>{:word_id => params[:word_id].strip})
58
-
59
- render :json=>{:content=>""} and return if !entity
60
- render :json=>{:content=>entity.content}
61
- end
62
-
63
- def change_word
64
-
65
- entity = nil
66
-
67
- if params[:id]
68
- entity = WhowishWord.first(:conditions=>{:id => params[:id]})
69
- else
70
- entity = WhowishWord.first(:conditions=>{:word_id => params[:word_id].strip})
71
- end
72
-
73
- if !entity
74
- #render :json=>{:ok=>false,:error_message=>"Cannot find "+params[:page_id]+":"+params[:word_id]} and return
75
-
76
- entity = WhowishWord.new
77
- entity.word_id = params[:word_id].strip
78
- entity.content = params[:content].strip
79
-
80
- end
81
-
82
- entity.word_id = params[:word_id].strip
83
- entity.content = params[:content].strip
84
- entity.save
85
-
86
- ActionView::Base.whowish_word[entity.word_id] = entity.content
87
-
88
- render :json=>{:ok=>true}
89
- end
90
-
91
- def add
92
-
93
- entity = WhowishWord.new
94
- entity.word_id = params[:word_id].strip
95
- entity.content = params[:content].strip
96
-
97
- if !entity.save
98
- render :json => {:ok=>false, :error_message=>format_error(entity.errors)}
99
- return
100
- end
101
-
102
- render :json=>{:ok=>true ,:new_row=>render_to_string(:partial=>"row.html",:locals=>{:entity=>entity,:field_set=>SHOW_FIELDS,:is_new=>false}), :entity=> entity}
103
-
104
- end
105
-
106
- def delete
107
-
108
- if !WhowishWord.delete(params[:id])
109
- render :json=>{:ok=>false,:error_message=>"error while delete location"}
110
- return
111
- end
112
-
113
- render :json=>{:ok=>true}
114
- end
115
- end
@@ -1,66 +0,0 @@
1
- class WhowishWordEmailController < ActionController::Base
2
-
3
- before_filter :compact_policy,:check_whowish_word_admin
4
-
5
- def check_whowish_word_admin
6
- $whowish_word_admin = session[:whowish_word_admin]
7
- end
8
-
9
- def compact_policy
10
- response.headers['P3P'] = 'policyref="/w3c/p3p.xml", CP="'+COMPACT_POLICY+'"'
11
- end
12
-
13
- layout "whowish_word_blank"
14
-
15
- def index
16
-
17
- end
18
-
19
- def add
20
-
21
- email = WhowishWordEmail.new
22
- email.page_id = params[:page_id].strip
23
- email.word_id = params[:word_id].strip
24
- email.content = params[:content].strip
25
- email.locale = "en"
26
-
27
- email.save
28
-
29
- ActionView::Base.whowish_word[entity.page_id] = {} if !ActionView::Base.whowish_word[entity.page_id]
30
- ActionView::Base.whowish_word[entity.page_id][entity.word_id.to_sym] = entity.content
31
-
32
- render :json=>{:ok=>true,:html=>(render_to_string :partial=>"row",:locals=>{:entity=>email,:is_new=>false})}
33
- end
34
-
35
- def edit
36
-
37
- entity = WhowishWordEmail.first(:conditions=>{:id=>params[:id]})
38
-
39
- if !entity
40
- render :json=>{:ok=>false,:error_message=>"The email record does not exist."}
41
- return
42
- end
43
-
44
- entity.page_id = params[:page_id].strip
45
- entity.word_id = params[:word_id].strip
46
- entity.content = params[:content].strip
47
- entity.locale = "en"
48
-
49
- ActionView::Base.whowish_word[entity.page_id] = {} if !ActionView::Base.whowish_word[entity.page_id]
50
- ActionView::Base.whowish_word[entity.page_id][entity.word_id.to_sym] = entity.content
51
-
52
- entity.save
53
-
54
- render :json=>{:ok=>true}
55
- end
56
-
57
- def delete
58
- if !WhowishWordEmail.delete(params[:id])
59
- render :json=>{:ok=>false,:error_message=>"error while delete location"}
60
- return
61
- end
62
-
63
- render :json=>{:ok=>true}
64
- end
65
-
66
- end
@@ -1,62 +0,0 @@
1
- class WhowishWordFacebookController < ActionController::Base
2
-
3
- before_filter :compact_policy,:check_whowish_word_admin
4
-
5
- def check_whowish_word_admin
6
- $whowish_word_admin = session[:whowish_word_admin]
7
- end
8
-
9
- def compact_policy
10
- response.headers['P3P'] = 'policyref="/w3c/p3p.xml", CP="'+COMPACT_POLICY+'"'
11
- end
12
-
13
- layout "whowish_word_blank"
14
-
15
-
16
- def index
17
-
18
- end
19
-
20
- def add
21
-
22
- facebook = WhowishWordFacebook.new(:publish_id=>params[:publish_id].strip,
23
- :message=>params[:message].strip,
24
- :name=>params[:name].strip,
25
- :caption=>params[:caption].strip,
26
- :description=>params[:description].strip,
27
- :locale=>"en"
28
- )
29
- facebook.save
30
-
31
- render :json=>{:ok=>true,:html=>(render_to_string :partial=>"row",:locals=>{:entity=>facebook,:is_new=>false})}
32
- end
33
-
34
- def edit
35
-
36
- facebook = WhowishWordFacebook.first(:conditions=>{:id=>params[:id]})
37
-
38
- if !facebook
39
- render :json=>{:ok=>false,:error_message=>"The facebook record does not exist."}
40
- return
41
- end
42
-
43
- facebook.update_attributes(:publish_id=>params[:publish_id].strip,
44
- :message=>params[:message].strip,
45
- :name=>params[:name].strip,
46
- :caption=>params[:caption].strip,
47
- :description=>params[:description].strip,
48
- :locale=>"en"
49
- )
50
-
51
- render :json=>{:ok=>true}
52
- end
53
-
54
- def delete
55
- if !WhowishWordFacebook.delete(params[:id])
56
- render :json=>{:ok=>false,:error_message=>"error while delete location"}
57
- return
58
- end
59
-
60
- render :json=>{:ok=>true}
61
- end
62
- end
@@ -1,12 +0,0 @@
1
- class WhowishWord
2
- include Mongoid::Document
3
-
4
- field :word_id,:type=>String
5
- field :content, :type=>String
6
-
7
- key :word_id
8
-
9
- def self.generate_word_id(page_id,id,locale)
10
- "#{page_id}:#{id}(#{locale})".downcase
11
- end
12
- end
@@ -1,10 +0,0 @@
1
- class WhowishWordEmail
2
- include Mongoid::Document
3
-
4
- field :word_id,:type=>String
5
- field :content, :type=>String
6
-
7
- key :word_id
8
-
9
-
10
- end
@@ -1,28 +0,0 @@
1
- class WhowishWordFacebook
2
-
3
- include Mongoid::Document
4
-
5
- field :publish_id,:type=>String
6
- field :message, :type=>String
7
- field :name, :type=>String
8
- field :caption, :type=>String
9
- field :description, :type=>String
10
-
11
- key :publish_id
12
-
13
- def word_for(field,*p)
14
-
15
- content = self[field].to_s
16
-
17
- if p.length > 0
18
- p = p[0]
19
-
20
- p.each_pair { |key,val|
21
- content.gsub!("{"+key.to_s+"}",val.to_s)
22
- }
23
- end
24
-
25
- content
26
- end
27
-
28
- end
@@ -1,5 +0,0 @@
1
- class WhowishWord < ActiveRecord::Base
2
- def self.generate_word_id(page_id,id,locale)
3
- "#{page_id}:#{id}(#{locale})".downcase
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class WhowishWordEmail < ActiveRecord::Base
2
-
3
-
4
-
5
- end
@@ -1,18 +0,0 @@
1
- class WhowishWordFacebook < ActiveRecord::Base
2
-
3
- def word_for(field,*p)
4
-
5
- content = self[field].to_s
6
-
7
- if p.length > 0
8
- p = p[0]
9
-
10
- p.each_pair { |key,val|
11
- content.gsub!("{"+key.to_s+"}",val.to_s)
12
- }
13
- end
14
-
15
- content
16
- end
17
-
18
- end
@@ -1,94 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" style="padding: 0px 0px 0px 0px; margin:0px 0px 0px 0px;">
3
- <head>
4
- <link rel="P3Pv1" href="/w3c/p3p.xml">
5
- <meta http-equiv="P3P" policyref="/w3c/p3p.xml" content='CP="<%=COMPACT_POLICY%>"'>
6
- <title>Whowish Wording System</title>
7
- <%= javascript_include_tag "jquery-1.6.2.min.js"%>
8
- <%= javascript_include_tag "/loading_button/jquery.loading_button.js"%>
9
- </head>
10
- <body>
11
- <style type="text/css">
12
- span, input,textarea {
13
- font-family: "lucida grande",tahoma,verdana,arial,sans-serif;
14
- margin:2px 2px 2px 2px;
15
- font-size:11px;
16
- }
17
- .edited {
18
- background-color: #CC9966 !important;
19
- }
20
- </style>
21
- <script language="javascript">
22
-
23
- var is_activated = "<%=($whowish_word_admin == true ? 'yes' : '')%>";
24
-
25
- function toggle_activate()
26
- {
27
- $('#activate_button').loading_button(true);
28
- is_activated = (is_activated=="yes")?"":"yes";
29
-
30
- $.ajax({
31
- type: "POST",
32
- url: '/whowish_word/activate',
33
- cache: false,
34
- data: {
35
- authenticity_token: "<%=form_authenticity_token%>",
36
- "enabled":is_activated
37
- },
38
- success: function(data){
39
- $('#activate_button').loading_button(false);
40
- try {
41
- if (data.ok == true) {
42
- if (is_activated=="yes")
43
- $('#activate_button').html('Deactivate Edit Mode');
44
- else
45
- $('#activate_button').html('Activate Edit Mode');
46
-
47
- }
48
- else {
49
- alert(data.error_message);
50
- }
51
- }
52
- catch (e) {
53
- alert(e);
54
- }
55
-
56
- },
57
- error: function(req, status, e){
58
- $('#activate_button').loading_button(false);
59
- if (req.status == 0) return;
60
- alert('Cannot connect to the server. Please try again later.');
61
-
62
- }
63
- });
64
- }
65
- </script>
66
- <span style="display:block;width:740px;">
67
- <a href="/whowish_word/index">All Wordings</a>
68
- &nbsp;&nbsp;
69
- <a href="/whowish_word_email">Emails</a>
70
- &nbsp;&nbsp;
71
- <a href="/whowish_word_facebook">Facebook Publish</a>
72
- &nbsp;&nbsp;
73
- <a href="#" id="activate_button" onclick="toggle_activate();return false;">
74
- <%
75
- if $whowish_word_admin
76
- %>
77
- Deactivate Edit Mode
78
- <%
79
- else
80
- %>
81
- Activate Edit Mode
82
- <%
83
- end
84
- %>
85
- </a>
86
- &nbsp;&nbsp;
87
- <a href="/whowish_word/logout">Logout</a>
88
- </span>
89
- <span style="display:block;width:740px;margin-top:20px;">
90
- <%=yield%>
91
- </span>
92
- </body>
93
- </html>
94
-