social_stream 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -2
  3. data/LICENSE +1 -1
  4. data/base/Rakefile +3 -17
  5. data/base/app/assets/images/flags/de.png +0 -0
  6. data/base/app/assets/images/flags/fr.png +0 -0
  7. data/base/app/assets/images/flags/hu.png +0 -0
  8. data/base/app/assets/images/flags/nl.png +0 -0
  9. data/base/app/assets/javascripts/social_stream/actor.js +34 -0
  10. data/base/app/assets/javascripts/social_stream/contact.js +40 -5
  11. data/base/app/assets/javascripts/social_stream/flash.js +6 -1
  12. data/base/app/assets/javascripts/social_stream/group.js +6 -5
  13. data/base/app/assets/javascripts/social_stream/relation_customs.js +0 -1
  14. data/base/app/assets/stylesheets/social_stream/base/adjust/layout/_adjust.css.sass +3 -0
  15. data/base/app/assets/stylesheets/social_stream/base/buttons/_buttons.scss.sass +0 -2
  16. data/base/app/assets/stylesheets/social_stream/base/contacts/_contacts.css.sass +1 -11
  17. data/base/app/assets/stylesheets/social_stream/base/contacts/layouts/_contacts.css.sass +1 -29
  18. data/base/app/assets/stylesheets/social_stream/base/layouts/_header.css.sass +0 -1
  19. data/base/app/assets/stylesheets/social_stream/base/mixins/_buttons.css.sass +5 -0
  20. data/base/app/assets/stylesheets/social_stream/base/mixins/_layout.css.sass +36 -7
  21. data/base/app/controllers/actors_controller.rb +25 -0
  22. data/base/app/controllers/contacts_controller.rb +38 -8
  23. data/base/app/controllers/groups_controller.rb +2 -21
  24. data/base/app/controllers/profiles_controller.rb +4 -0
  25. data/base/app/controllers/settings_controller.rb +12 -2
  26. data/base/app/controllers/users_controller.rb +0 -8
  27. data/base/app/helpers/contacts_helper.rb +8 -0
  28. data/base/app/models/activity.rb +19 -6
  29. data/base/app/models/actor.rb +49 -11
  30. data/base/app/models/contact.rb +12 -5
  31. data/base/app/models/group.rb +13 -11
  32. data/base/app/models/permission.rb +30 -0
  33. data/base/app/models/relation.rb +17 -7
  34. data/base/app/models/relation/custom.rb +2 -40
  35. data/base/app/models/relation/follow.rb +8 -2
  36. data/base/app/models/relation/owner.rb +10 -0
  37. data/base/app/models/relation/single.rb +7 -4
  38. data/base/app/models/site.rb +1 -1
  39. data/base/app/models/tie.rb +8 -4
  40. data/base/app/views/contacts/_add_button.html.erb +9 -0
  41. data/base/app/views/contacts/_button.html.erb +3 -3
  42. data/base/app/views/contacts/_button_multiple.html.erb +4 -0
  43. data/base/app/views/contacts/_button_simple.html.erb +17 -0
  44. data/base/app/views/contacts/_new_modal.html.erb +22 -0
  45. data/base/app/views/contacts/destroy.js.erb +5 -4
  46. data/base/app/views/contacts/update.js.erb +5 -4
  47. data/base/app/views/devise/confirmations/new.html.erb +14 -9
  48. data/base/app/views/frontpage/_presentation.html.erb +2 -2
  49. data/base/app/views/groups/_form.html.erb +20 -20
  50. data/base/app/views/groups/show.html.erb +5 -5
  51. data/base/app/views/layouts/_header_dropdown_menu.html.erb +3 -5
  52. data/base/app/views/layouts/_header_signed_in.erb +3 -3
  53. data/base/app/views/layouts/_logo_in.html.erb +1 -1
  54. data/base/app/views/layouts/application.html.erb +2 -0
  55. data/base/app/views/permissions/_list.html.erb +1 -1
  56. data/base/app/views/profiles/_avatar.html.erb +1 -5
  57. data/base/app/views/profiles/_avatar_edit.html.erb +5 -0
  58. data/base/app/views/profiles/_comunication-info.html.erb +2 -36
  59. data/base/app/views/profiles/_comunication-info_edit.html.erb +27 -0
  60. data/base/app/views/profiles/_edit_icon.html.erb +0 -1
  61. data/base/app/views/profiles/_experience.html.erb +1 -6
  62. data/base/app/views/profiles/_experience_edit.html.erb +5 -0
  63. data/base/app/views/profiles/_personal.html.erb +1 -39
  64. data/base/app/views/profiles/_personal_edit.html.erb +31 -0
  65. data/base/app/views/profiles/_profile_edit.html.erb +7 -0
  66. data/base/app/views/profiles/_tags.html.erb +1 -4
  67. data/base/app/views/profiles/_tags_edit.html.erb +4 -0
  68. data/base/app/views/profiles/edit.html.erb +24 -0
  69. data/base/app/views/settings/_notifications.html.erb +12 -4
  70. data/base/app/views/users/show.html.erb +5 -5
  71. data/base/config/locales/de.yml +654 -0
  72. data/base/config/locales/en.yml +20 -9
  73. data/base/config/locales/es.yml +151 -140
  74. data/base/config/locales/fr.yml +656 -0
  75. data/base/config/locales/hu.yml +653 -0
  76. data/base/config/locales/nl.yml +656 -0
  77. data/base/config/locales/pt.yml +250 -239
  78. data/base/config/locales/rails.de.yml +203 -0
  79. data/base/config/locales/rails.fr.yml +222 -0
  80. data/base/config/locales/rails.hu.yml +199 -0
  81. data/base/config/locales/rails.nl.yml +199 -0
  82. data/base/config/locales/zh.yml +214 -202
  83. data/base/config/routes.rb +22 -30
  84. data/base/db/migrate/20130708152633_set_group_owners.rb +19 -0
  85. data/base/db/migrate/20130723133530_actor_notification_settings.rb +10 -0
  86. data/base/lib/generators/social_stream/base/templates/initializer.rb +13 -7
  87. data/base/lib/rails/social_stream.rb +2 -0
  88. data/base/lib/social_stream/base.rb +27 -7
  89. data/base/lib/social_stream/base/ability.rb +3 -5
  90. data/base/lib/social_stream/base/autoload.rb +1 -0
  91. data/base/lib/social_stream/base/version.rb +1 -1
  92. data/base/lib/social_stream/controllers/authorship.rb +18 -0
  93. data/base/lib/social_stream/controllers/helpers.rb +18 -4
  94. data/base/lib/social_stream/controllers/objects.rb +2 -8
  95. data/base/lib/social_stream/controllers/subjects.rb +9 -2
  96. data/base/lib/social_stream/models/supertype.rb +2 -0
  97. data/base/lib/social_stream/population/activity_object.rb +6 -8
  98. data/base/lib/social_stream/routing/mapper.rb +52 -0
  99. data/base/social_stream-base.gemspec +4 -7
  100. data/base/spec/controllers/groups_controller_spec.rb +19 -8
  101. data/base/spec/controllers/posts_controller_spec.rb +114 -147
  102. data/base/spec/models/post_authorization_spec.rb +190 -204
  103. data/base/spec/models/post_spec.rb +17 -63
  104. data/base/vendor/assets/javascripts/bootstrap-multiselect.js +434 -127
  105. data/documents/Rakefile +1 -6
  106. data/documents/config/locales/de.yml +93 -0
  107. data/documents/config/locales/es.yml +2 -2
  108. data/documents/config/locales/fr.yml +93 -0
  109. data/documents/config/locales/hu.yml +93 -0
  110. data/documents/config/locales/nl.yml +93 -0
  111. data/documents/config/locales/zh.yml +4 -4
  112. data/documents/config/routes.rb +7 -9
  113. data/documents/lib/social_stream/documents/version.rb +1 -1
  114. data/documents/social_stream-documents.gemspec +4 -4
  115. data/events/Rakefile +1 -6
  116. data/events/config/locales/es.yml +3 -3
  117. data/events/config/locales/zh.yml +3 -3
  118. data/events/lib/social_stream/events/models/actor.rb +2 -1
  119. data/events/lib/social_stream/events/version.rb +1 -1
  120. data/events/social_stream-events.gemspec +1 -1
  121. data/lib/generators/social_stream/install_generator.rb +1 -0
  122. data/lib/social_stream.rb +1 -0
  123. data/lib/social_stream/version.rb +1 -1
  124. data/lib/tasks/i18n.rake +22 -2
  125. data/linkser/Rakefile +1 -6
  126. data/linkser/config/locales/de.yml +17 -0
  127. data/linkser/config/locales/es.yml +2 -2
  128. data/linkser/config/locales/fr.yml +17 -0
  129. data/linkser/config/locales/hu.yml +17 -0
  130. data/linkser/config/locales/nl.yml +17 -0
  131. data/linkser/config/locales/zh.yml +2 -2
  132. data/linkser/lib/social_stream/linkser/version.rb +1 -1
  133. data/linkser/social_stream-linkser.gemspec +1 -1
  134. data/oauth2_server/Rakefile +1 -6
  135. data/oauth2_server/app/assets/images/step_1.png +0 -0
  136. data/oauth2_server/app/assets/images/step_2.png +0 -0
  137. data/oauth2_server/app/assets/images/step_3.png +0 -0
  138. data/oauth2_server/app/assets/javascripts/social_stream/site_client.js +27 -0
  139. data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/applications/layout/_applications-oauth2server.css.sass +0 -5
  140. data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/create/layout/_create-oauth2server.css.sass +3 -5
  141. data/oauth2_server/app/assets/stylesheets/social_stream/oauth2_server/show/layout/_show-oauth2server.css.sass +8 -6
  142. data/oauth2_server/app/controllers/site/clients_controller.rb +17 -41
  143. data/oauth2_server/app/decorators/social_stream/base/relation_decorator.rb +2 -0
  144. data/oauth2_server/app/decorators/social_stream/base/user_decorator.rb +1 -20
  145. data/oauth2_server/app/models/relation/manager.rb +1 -10
  146. data/oauth2_server/app/models/site/client.rb +4 -2
  147. data/oauth2_server/app/views/site/clients/_destroy.html.erb +11 -0
  148. data/oauth2_server/app/views/site/clients/_edit.html.erb +9 -2
  149. data/oauth2_server/app/views/site/clients/_edit_step_2.html.erb +6 -6
  150. data/oauth2_server/app/views/site/clients/_edit_step_3.html.erb +8 -6
  151. data/oauth2_server/app/views/site/clients/_form.html.erb +11 -11
  152. data/oauth2_server/app/views/site/clients/_list.html.erb +23 -11
  153. data/oauth2_server/app/views/site/clients/edit.html.erb +1 -1
  154. data/oauth2_server/app/views/site/clients/index.html.erb +9 -40
  155. data/oauth2_server/app/views/site/clients/show.html.erb +66 -68
  156. data/oauth2_server/config/locales/en.yml +19 -0
  157. data/oauth2_server/config/locales/es.yml +23 -4
  158. data/oauth2_server/config/locales/zh.yml +32 -13
  159. data/oauth2_server/config/routes.rb +3 -1
  160. data/oauth2_server/lib/social_stream/oauth2_server.rb +4 -1
  161. data/oauth2_server/lib/social_stream/oauth2_server/ability.rb +1 -1
  162. data/oauth2_server/lib/social_stream/oauth2_server/models/user.rb +18 -0
  163. data/oauth2_server/lib/social_stream/oauth2_server/version.rb +1 -1
  164. data/oauth2_server/social_stream-oauth2_server.gemspec +1 -1
  165. data/oauth2_server/spec/controllers/site_clients_controller_authorization_spec.rb +7 -0
  166. data/ostatus/Rakefile +1 -6
  167. data/ostatus/config/locales/zh.yml +8 -8
  168. data/ostatus/lib/social_stream-ostatus.rb +3 -0
  169. data/ostatus/lib/social_stream/ostatus/version.rb +1 -1
  170. data/ostatus/social_stream-ostatus.gemspec +1 -1
  171. data/places/config/locales/es.yml +51 -51
  172. data/presence/config/locales/es.yml +48 -48
  173. data/presence/config/locales/zh.yml +48 -48
  174. data/presence/lib/social_stream/presence/version.rb +1 -1
  175. data/presence/social_stream-presence.gemspec +1 -1
  176. data/social_stream.gemspec +8 -7
  177. metadata +60 -29
  178. data/base/app/assets/javascripts/social_stream/follow.js +0 -28
  179. data/base/app/controllers/followers_controller.rb +0 -34
  180. data/base/app/helpers/followers_helper.rb +0 -5
  181. data/base/app/views/contacts/_link_follow.html.erb +0 -16
  182. data/base/app/views/followers/destroy.js.erb +0 -1
  183. data/base/app/views/followers/index.html.erb +0 -30
  184. data/base/app/views/followers/update.js.erb +0 -3
  185. data/base/app/views/frontpage/_characteristics.html.erb +0 -23
  186. data/base/lib/social_stream/routing/constraints/custom.rb +0 -11
  187. data/base/lib/social_stream/routing/constraints/follow.rb +0 -11
  188. data/base/spec/controllers/followers_controller_spec.rb +0 -37
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Documents
3
- VERSION = "2.1.0".freeze
3
+ VERSION = "2.2.0".freeze
4
4
  end
5
5
  end
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 2.1.0')
15
+ s.add_runtime_dependency('social_stream-base', '~> 2.2.0')
16
16
 
17
- s.add_runtime_dependency('paperclip','~> 3.3.0')
18
- s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.9.0')
19
- s.add_runtime_dependency('delayed_paperclip','>= 2.4.5.2')
17
+ s.add_runtime_dependency('paperclip','~> 3.5.1')
18
+ s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.11.0')
19
+ s.add_runtime_dependency('delayed_paperclip','>= 2.6.1')
20
20
  end
@@ -3,12 +3,7 @@ require 'bundler/gem_tasks'
3
3
 
4
4
  require 'rdoc/task'
5
5
 
6
- require 'rspec/core'
7
- require 'rspec/core/rake_task'
8
-
9
- RSpec::Core::RakeTask.new(:spec)
10
-
11
- task :default => :spec
6
+ task :default => :rdoc
12
7
 
13
8
  Rake::RDocTask.new(:rdoc) do |rdoc|
14
9
  rdoc.rdoc_dir = 'rdoc'
@@ -3,9 +3,9 @@ es:
3
3
  activerecord:
4
4
  attributes:
5
5
  event:
6
- title: Título
7
- room: Espacio
8
6
  frequency: Repetición
7
+ room: Espacio
8
+ title: Título
9
9
  room:
10
10
  name: Nombre
11
11
  errors:
@@ -51,7 +51,7 @@ es:
51
51
  confirm_delete: ¿Borrar espacio?
52
52
  delete: Borrar
53
53
  settings:
54
- title: Espacios
55
54
  description: Salas disponibles para la realización de eventos
55
+ title: Espacios
56
56
  watermark:
57
57
  name: Nuevo espacio
@@ -3,9 +3,9 @@ zh:
3
3
  activerecord:
4
4
  attributes:
5
5
  event:
6
- title: Title
7
- room: Room
8
6
  frequency: Frequency
7
+ room: Room
8
+ title: Title
9
9
  room:
10
10
  name: Name
11
11
  errors:
@@ -51,7 +51,7 @@ zh:
51
51
  confirm_delete: Delete room?
52
52
  delete: Delete
53
53
  settings:
54
- title: Rooms
55
54
  description: Rooms available for event celebration
55
+ title: Rooms
56
56
  watermark:
57
57
  name: New room
@@ -5,7 +5,8 @@ module SocialStream
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- has_many :rooms
8
+ has_many :rooms,
9
+ dependent: :destroy
9
10
  end
10
11
 
11
12
  def events
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Events
3
- VERSION = "2.1.0".freeze
3
+ VERSION = "2.2.0".freeze
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 2.1.0')
15
+ s.add_runtime_dependency('social_stream-base', '~> 2.2.0')
16
16
  s.add_runtime_dependency('rails-scheduler', '~> 0.1.2')
17
17
 
18
18
  # Development Gem dependencies
@@ -5,4 +5,5 @@ class SocialStream::InstallGenerator < Rails::Generators::Base #:nodoc:
5
5
  hook_for :linkser
6
6
  hook_for :chat
7
7
  hook_for :federation
8
+ hook_for :oauth2_server
8
9
  end
@@ -18,6 +18,7 @@ module SocialStream
18
18
  config.app_generators.linkser 'social_stream:linkser'
19
19
  config.app_generators.chat 'social_stream:presence'
20
20
  config.app_generators.federation 'social_stream:ostatus'
21
+ config.app_generators.oauth2_server 'social_stream:oauth2_server'
21
22
  end
22
23
  end
23
24
 
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "2.1.1".freeze
2
+ VERSION = "2.2.0".freeze
3
3
  end
@@ -9,7 +9,6 @@ namespace :i18n do
9
9
  en_hash = h.dup
10
10
 
11
11
  each_key do |self_key|
12
- # require 'debugger'; debugger
13
12
  en_val = en_hash.delete(self_key)
14
13
 
15
14
  case en_val
@@ -30,21 +29,42 @@ namespace :i18n do
30
29
  end
31
30
  end
32
31
 
32
+ # Merge missing keys
33
33
  merge! en_hash
34
+
35
+ # Order alphabetically
36
+ replace sort_by{ |k, v| k }.inject({}){ |h, a| h[a.first] = a.last; h }
34
37
  end
35
38
  end
36
39
 
37
40
  SocialStream::ALL_COMPONENTS.each do |c|
38
41
  path = "#{ c }/config/locales/"
42
+
39
43
  files = Dir[path + '*'].select{ |f| f =~ /\/\w+\.yml$/ }
44
+
40
45
  en = files.find{ |f| f =~ /\/en.yml$/ }
41
46
  files.delete(en)
47
+
42
48
  en_h = Psych.load_file(en)
43
49
 
44
50
  files.each do |f|
45
51
  h = Psych.load_file(f)
46
52
 
47
- h.first.last.sync en_h.first.last
53
+ # Leave language_name at the begining of the hash
54
+ if c == "base"
55
+ orig_h = h.first.last
56
+ orig_en_h = en_h.first.last.dup
57
+
58
+ language_name = orig_h.delete('language_name')
59
+ language_name_en = orig_en_h.delete('language_name')
60
+ language_name ||= language_name_en
61
+
62
+ orig_h.sync orig_en_h
63
+
64
+ h.first.last.replace({ 'language_name' => language_name }.merge!(orig_h))
65
+ else
66
+ h.first.last.sync en_h.first.last
67
+ end
48
68
 
49
69
  Psych.dump h, File.open(f, 'w')
50
70
  end
@@ -3,12 +3,7 @@ require 'bundler/gem_tasks'
3
3
 
4
4
  require 'rdoc/task'
5
5
 
6
- require 'rspec/core'
7
- require 'rspec/core/rake_task'
8
-
9
- RSpec::Core::RakeTask.new(:spec)
10
-
11
- task :default => :spec
6
+ task :default => :rdoc
12
7
 
13
8
  Rake::RDocTask.new(:rdoc) do |rdoc|
14
9
  rdoc.rdoc_dir = 'rdoc'
@@ -0,0 +1,17 @@
1
+ ---
2
+ de:
3
+ link:
4
+ by: by %{author}
5
+ confirm_delete: Link löschen?
6
+ errors:
7
+ loading: Fehler beim Laden
8
+ only_webs: Nur Webseiten werden unterstützt
9
+ form:
10
+ title: Link
11
+ input: Gib die Web Addresse ein
12
+ name: Link
13
+ one: Ein Link
14
+ other: links
15
+ title: Links
16
+ linkser:
17
+ title: Linkser
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  es:
3
- linkser:
4
- title: Linkser
5
3
  link:
6
4
  by: por %{author}
7
5
  confirm_delete: ¿Borrar enlace?
@@ -15,3 +13,5 @@ es:
15
13
  one: un enlace
16
14
  other: enlaces
17
15
  title: Enlaces
16
+ linkser:
17
+ title: Linkser
@@ -0,0 +1,17 @@
1
+ ---
2
+ fr:
3
+ link:
4
+ by: by %{author}
5
+ confirm_delete: Supprimer le lien ?
6
+ errors:
7
+ loading: Erreur de chargement
8
+ only_webs: Seules les pages Web sont prises en charge
9
+ form:
10
+ title: Lien
11
+ input: Saisir l'adresse Web
12
+ name: lien
13
+ one: un lien
14
+ other: links
15
+ title: Liens
16
+ linkser:
17
+ title: Linkser
@@ -0,0 +1,17 @@
1
+ ---
2
+ hu:
3
+ link:
4
+ by: by %{author}
5
+ confirm_delete: Törlöd a linket?
6
+ errors:
7
+ loading: Töltési hiba
8
+ only_webs: Csak a weboldalak támogatottak
9
+ form:
10
+ title: Link
11
+ input: Írd be a web címet
12
+ name: link
13
+ one: egy link
14
+ other: links
15
+ title: Linkek
16
+ linkser:
17
+ title: Hivatkozás megosztása
@@ -0,0 +1,17 @@
1
+ ---
2
+ nl:
3
+ link:
4
+ by: by %{author}
5
+ confirm_delete: Link verwijderen?
6
+ errors:
7
+ loading: Fout bij het laden
8
+ only_webs: Alleen webpagina’s worden ondersteund
9
+ form:
10
+ title: Link
11
+ input: Het webadres schrijven
12
+ name: link
13
+ one: een link
14
+ other: links
15
+ title: Links
16
+ linkser:
17
+ title: Linkser
@@ -1,7 +1,5 @@
1
1
  ---
2
2
  zh:
3
- linkser:
4
- title: Linkser
5
3
  link:
6
4
  by: by %{author}
7
5
  confirm_delete: Delete link?
@@ -15,3 +13,5 @@ zh:
15
13
  one: a link
16
14
  other: links
17
15
  title: Links
16
+ linkser:
17
+ title: Linkser
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Linkser
3
- VERSION = "2.1.0".freeze
3
+ VERSION = "2.2.0".freeze
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 2.1.0')
15
+ s.add_runtime_dependency('social_stream-base', '~> 2.2.0')
16
16
  s.add_runtime_dependency('linkser', '~> 0.0.12')
17
17
  # Development Gem dependencies
18
18
  s.add_development_dependency('sqlite3-ruby')
@@ -3,12 +3,7 @@ require 'bundler/gem_tasks'
3
3
 
4
4
  require 'rdoc/task'
5
5
 
6
- require 'rspec/core'
7
- require 'rspec/core/rake_task'
8
-
9
- RSpec::Core::RakeTask.new(:spec)
10
-
11
- task :default => :spec
6
+ task :default => :rdoc
12
7
 
13
8
  Rake::RDocTask.new(:rdoc) do |rdoc|
14
9
  rdoc.rdoc_dir = 'rdoc'
@@ -1,4 +1,5 @@
1
1
  //= require social_stream/callback
2
+ //= require social_stream/flash
2
3
 
3
4
  SocialStream.SiteClient = (function(SS, $, undefined) {
4
5
  var callback = new SS.Callback();
@@ -7,8 +8,34 @@ SocialStream.SiteClient = (function(SS, $, undefined) {
7
8
  $('.new_site_client-modal-link').attr('href', '#new_site_client-modal');
8
9
  };
9
10
 
11
+ var initRefreshButton = function() {
12
+ $('form.site-client-secret').submit(sendSecretRefresh);
13
+ };
14
+
15
+ var sendSecretRefresh = function(e) {
16
+ var form = $(e.target);
17
+
18
+ e.preventDefault();
19
+
20
+ $.ajax({
21
+ url: form.attr('action'),
22
+ method: form.attr('method'),
23
+ dataType: 'json',
24
+ success: function(data) {
25
+ SS.Flash.success(I18n.t('site.client.oauth.secret.refreshed'));
26
+
27
+ $('span.site-client-secret').html(data.secret).effect('highlight', {}, 3000);
28
+ },
29
+ error: function(jqXHR, textStatus) {
30
+ SS.Flash.error(textStatus);
31
+ }
32
+ });
33
+ };
34
+
10
35
  callback.register('index', initNewModal);
11
36
 
37
+ callback.register('show', initRefreshButton);
38
+
12
39
  return callback.extend({
13
40
  });
14
41
 
@@ -29,9 +29,7 @@
29
29
  .description
30
30
  textarea
31
31
  height: 60px
32
- input
33
- &[type="submit"]
34
- @include btn-primary
35
- @include border-radius (5px)
36
-
32
+ .next-step
33
+ @include btn-secundary
34
+ float: right
37
35
 
@@ -37,12 +37,14 @@
37
37
  padding: 0 2.5%
38
38
  margin-bottom: 30px
39
39
  display: inline-block
40
- h1
41
- @include clearfix
42
- margin-bottom: 4px
43
- margin-left: -2.5%
44
- a
45
- font-size: 13px
40
+ header
41
+ margin-top: -37px
42
+ h4
43
+ @include clearfix
44
+ margin-bottom: 4px
45
+ margin-left: -2.5%
46
+ a
47
+ font-size: 13px
46
48
  .soften
47
49
  margin-bottom: 0px
48
50
  .content
@@ -1,60 +1,36 @@
1
1
  class Site::ClientsController < ApplicationController
2
- before_filter :authenticate_user!
2
+ include SocialStream::Controllers::Subjects
3
+ include SocialStream::Controllers::Authorship
3
4
 
4
- before_filter :set_author_ids, only: [ :new, :create, :update ]
5
+ before_filter :authenticate_user!
5
6
 
6
7
  load_and_authorize_resource
7
8
 
8
- def index
9
- @clients = current_subject.managed_site_clients
10
- end
11
-
12
9
  def create
13
- @client = Site::Client.new params[:site_client]
14
-
15
- if @client.save
16
- respond_to do |format|
17
- format.html {
18
- redirect_to edit_site_client_path(@client, step: 2)
19
- }
20
- end
21
- else
22
- respond_to do |format|
23
- format.html { render :new }
24
- end
10
+ create! do |success, error|
11
+ success.html {
12
+ redirect_to polymorphic_path(resource, action: :edit, step: 2)
13
+ }
14
+ error.html { render :new }
25
15
  end
26
16
  end
27
17
 
28
- def edit
29
- @client = Site::Client.find params[:id]
30
- end
18
+ # Refresh the site client token
19
+ def update_secret
20
+ resource.refresh_secret!
31
21
 
32
- def update
33
- @client = Site::Client.find params[:id]
34
-
35
- if @client.update_attributes params[:client]
36
- respond_to do |format|
37
- format.html { redirect_to @client }
38
- end
39
- else
40
- respond_to do |format|
41
- format.html { render :edit }
42
- end
22
+ respond_to do |format|
23
+ format.json { render json: { secret: resource.secret } }
43
24
  end
44
25
  end
45
26
 
46
27
  def destroy
47
- @client.destroy
48
-
49
- redirect_to home_path
28
+ destroy! { :home }
50
29
  end
51
30
 
52
- private
31
+ protected
53
32
 
54
- def set_author_ids
55
- params[:site_client] ||= HashWithIndifferentAccess.new
56
- params[:site_client][:author_id] = current_subject.actor_id
57
- params[:site_client][:user_author_id] = current_user.actor_id
58
- params[:site_client][:owner_id] = current_subject.actor_id
33
+ def collection
34
+ current_subject.managed_site_clients
59
35
  end
60
36
  end