droom 0.2.1 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/app/assets/images/droom/Untitled-1.png +0 -0
  2. data/app/assets/images/droom/asterisk.png +0 -0
  3. data/app/assets/images/droom/dropbox_small.png +0 -0
  4. data/app/assets/images/droom/handle.png +0 -0
  5. data/app/assets/images/droom/minisymbols.png +0 -0
  6. data/app/assets/images/droom/revoke_small.png +0 -0
  7. data/app/assets/images/droom/toggle.png +0 -0
  8. data/app/assets/javascripts/droom.js.coffee +4 -4
  9. data/app/assets/javascripts/droom/actions.js.coffee +16 -5
  10. data/app/assets/javascripts/droom/lib/wysihtml5.js +18 -0
  11. data/app/assets/javascripts/droom/widgets.js.coffee +72 -111
  12. data/app/assets/stylesheets/droom.css.sass +195 -119
  13. data/app/assets/stylesheets/{_definitions.css.sass → droom/_mixins.css.sass} +28 -43
  14. data/app/assets/stylesheets/{lib → droom}/_popups.css.sass +0 -0
  15. data/app/assets/stylesheets/{lib → droom}/_toolbar.css.sass +2 -4
  16. data/app/assets/stylesheets/droom/_variables.css.sass +46 -0
  17. data/app/assets/stylesheets/lib/_kalendae.css.sass +2 -2
  18. data/app/controllers/droom/engine_controller.rb +5 -1
  19. data/app/controllers/droom/events_controller.rb +9 -6
  20. data/app/controllers/droom/groups_controller.rb +1 -1
  21. data/app/controllers/droom/organisations_controller.rb +1 -1
  22. data/app/controllers/droom/people_controller.rb +18 -18
  23. data/app/controllers/droom/suggestions_controller.rb +0 -1
  24. data/app/controllers/droom/user_confirmations_controller.rb +55 -0
  25. data/app/controllers/droom/users_controller.rb +1 -2
  26. data/app/controllers/droom/youtube_controller.rb +4 -1
  27. data/app/helpers/droom/droom_helper.rb +3 -3
  28. data/app/models/droom/document.rb +3 -27
  29. data/app/models/droom/event.rb +0 -12
  30. data/app/models/droom/folder.rb +9 -10
  31. data/app/models/droom/group.rb +0 -7
  32. data/app/models/droom/person.rb +13 -20
  33. data/app/models/droom/scrap.rb +2 -12
  34. data/app/models/droom/user.rb +29 -5
  35. data/app/models/droom/venue.rb +0 -17
  36. data/app/views/{droom/users/unwelcome.en.html.haml → devise/confirmations/failure.en.html.haml} +5 -2
  37. data/app/views/devise/confirmations/new.html.haml +25 -0
  38. data/app/views/devise/confirmations/show.html.haml +32 -0
  39. data/app/views/droom/dashboard/_documents.html.haml +9 -0
  40. data/app/views/droom/dashboard/_folders.html.haml +1 -1
  41. data/app/views/droom/dashboard/_groups.html.haml +9 -0
  42. data/app/views/droom/documents/_document.html.haml +1 -1
  43. data/app/views/droom/documents/_table_document.html.haml +1 -1
  44. data/app/views/droom/events/_event.html.haml +0 -1
  45. data/app/views/droom/events/edit.html.haml +1 -1
  46. data/app/views/droom/events/index.html.haml +6 -4
  47. data/app/views/droom/events/new.html.haml +1 -1
  48. data/app/views/droom/events/show.html.haml +1 -1
  49. data/app/views/droom/folders/_folder.html.haml +2 -2
  50. data/app/views/droom/folders/edit.html.haml +1 -1
  51. data/app/views/droom/folders/index.html.haml +3 -1
  52. data/app/views/droom/folders/new.html.haml +1 -1
  53. data/app/views/droom/groups/_group.html.haml +6 -3
  54. data/app/views/droom/groups/edit.html.haml +1 -1
  55. data/app/views/droom/groups/index.html.haml +20 -1
  56. data/app/views/droom/groups/new.html.haml +1 -1
  57. data/app/views/droom/organisations/_action_menu.html.haml +3 -1
  58. data/app/views/droom/organisations/_organisation.html.haml +0 -1
  59. data/app/views/droom/organisations/edit.html.haml +1 -1
  60. data/app/views/droom/organisations/new.html.haml +1 -1
  61. data/app/views/droom/panels/_dropbox.html.haml +1 -1
  62. data/app/views/droom/panels/{_search.html.haml → _suggestions.html.haml} +3 -4
  63. data/app/views/droom/people/_form.html.haml +15 -19
  64. data/app/views/droom/people/_listing.html.haml +1 -1
  65. data/app/views/droom/people/_person.html.haml +3 -3
  66. data/app/views/droom/people/_suggested.html.haml +1 -1
  67. data/app/views/droom/people/edit.html.haml +1 -1
  68. data/app/views/droom/people/new.html.haml +1 -1
  69. data/app/views/droom/people/show.html.haml +31 -1
  70. data/app/views/droom/scraps/full/_document.html.haml +1 -1
  71. data/app/views/droom/scraps/thumbs/_document.html.haml +2 -2
  72. data/app/views/droom/shared/{_search_form.html.haml → _suggestion_form.html.haml} +1 -1
  73. data/app/views/droom/users/_extra_columns.html.haml +0 -0
  74. data/app/views/droom/users/_extra_columns_header.html.haml +0 -0
  75. data/app/views/droom/users/_extra_columns_note.html.haml +0 -0
  76. data/app/views/droom/users/_form.html.haml +5 -12
  77. data/app/views/droom/users/_user_or_person.html.haml +24 -15
  78. data/app/views/droom/users/_users_table.html.haml +24 -6
  79. data/app/views/droom/users/edit.html.haml +1 -1
  80. data/app/views/droom/users/index.html.haml +2 -5
  81. data/config/locales/devise.en.yml +1 -1
  82. data/config/locales/en.yml +22 -7
  83. data/config/routes.rb +4 -3
  84. data/lib/droom.rb +28 -14
  85. data/lib/droom/engine.rb +2 -0
  86. data/lib/droom/version.rb +1 -1
  87. data/spec/dummy/log/dav.log +1 -0
  88. data/spec/dummy/log/development.log +2 -0
  89. data/spec/dummy/log/test.log +1 -0
  90. metadata +29 -33
  91. data/app/controllers/droom/confirmations_controller.rb +0 -38
  92. data/app/controllers/droom/search_controller.rb +0 -66
  93. data/app/views/cropper/uploads/_crop.html.haml +0 -46
  94. data/app/views/devise/mailer/confirmation_instructions.en.html.haml +0 -24
  95. data/app/views/devise/mailer/reset_password_instructions.en.html.haml +0 -21
  96. data/app/views/droom/shared/_search_results.html.haml +0 -9
  97. data/app/views/droom/shared/search.html.haml +0 -18
@@ -1,38 +0,0 @@
1
- module Droom
2
- class ConfirmationsController < Devise::ConfirmationsController
3
-
4
- # If user not yet confirmed, show password form (rather than just confirming, as it normal)
5
- # If already confirmed, allow devise to do whatever devise does.
6
- #
7
- def show
8
- self.resource = resource_class.find_by_confirmation_token(params[:confirmation_token])
9
- super if resource.confirmed?
10
- end
11
-
12
- # the purpose of this is to add another step between user creation and user confirmation, such that
13
- # we perform the confirmation only if a password is supplied and validates.
14
- #
15
- # NB. in the tortured RESTfulness of devise, that means turning confirmation#show into a password form
16
- # and using confirmations#update to update the user object accordingly.
17
- #
18
- def update
19
- self.resource = resource_class.find_by_confirmation_token(params[resource_name][:confirmation_token])
20
-
21
- result = resource.update_attributes(params[resource_name].except(:confirmation_token))
22
-
23
- Rails.logger.warn ">>> update_attributes gave us #{result.inspect} and password #{resource.password} / #{resource.password_confirmation}"
24
- Rails.logger.warn ">>> errors: #{resource.errors.full_messages}"
25
-
26
- if result && resource.password_match?
27
- self.resource = resource_class.confirm_by_token(params[resource_name][:confirmation_token])
28
- set_flash_message :notice, :confirmed
29
- sign_in_and_redirect(resource_name, resource)
30
- else
31
- # back to the password form
32
- set_flash_message :error, :password_error
33
- render :action => "show"
34
- end
35
- end
36
-
37
- end
38
- end
@@ -1,66 +0,0 @@
1
- module Droom
2
- class SearchController < Droom::EngineController
3
- respond_to :json, :js, :html
4
- before_filter :authenticate_user!
5
- before_filter :get_classes
6
- before_filter :get_fields
7
-
8
- def index
9
- @results = []
10
- if @fragment = params[:term]
11
- @page = params[:page] || 1
12
- frag = @fragment.force_encoding("US-ASCII")
13
- # if term isn't empty
14
- unless frag == ""
15
- classes = Droom.searchable_classes.values.collect {|klass| klass.constantize}
16
- highlights = @highlights.collect {|field| field.to_sym}
17
- # search the searchable classes
18
- # highlight matching words from highlightable fields
19
- search = Sunspot.search classes do
20
- fulltext frag do
21
- highlights.each do |hl|
22
- highlight hl
23
- end
24
- with visible_to?(current_person)
25
- end
26
- paginate :page => @page, :per_page => 10
27
- end
28
- # push the hits (for retrieving highlights) into the search results
29
- search.each_hit_with_result do |hit, result|
30
- if @requested_types.include? result.class.to_s
31
- result[:hit] = if hit.highlights.length > 0 then hit else nil end
32
- @results.push result
33
- end
34
- end
35
- end
36
- end
37
- respond_with @results do |format|
38
- format.html { render "droom/shared/search" }
39
- format.json { render :json => @results.map(&:as_search_result).to_json }
40
- format.js { render :partial => "droom/shared/search_results" }
41
- end
42
- end
43
-
44
- protected
45
-
46
- def get_fields
47
- @highlights = []
48
- @requested_types.each do |klass|
49
- klass.constantize.highlight_fields.each do |hlf|
50
- @highlights.push hlf unless @highlights.include? hlf
51
- end
52
- end
53
- end
54
-
55
- def get_classes
56
- searchable_classes = Droom.searchable_classes
57
- @types = [params[:type]].flatten.compact.uniq
58
- @types = searchable_classes.keys if @types.empty?
59
-
60
- logger.warn ">>> requested_types is #{@types.inspect}"
61
-
62
- @requested_types = searchable_classes.values_at(*@types)
63
- end
64
-
65
- end
66
- end
@@ -1,46 +0,0 @@
1
- // default state of precrop upload
2
-
3
- - upload ||= @upload
4
- - recipient = (params[:for] || "scrap").to_sym
5
-
6
- - if recipient == :scrap
7
- - object = Droom::Scrap.new
8
- - w = 580
9
- - h = 326
10
- - multiplier = 1
11
-
12
- - elsif recipient == :person
13
- - object = Droom::Person.new
14
- - w = 130
15
- - h = 130
16
- - multiplier = 4
17
-
18
- - prefix = 'image'
19
-
20
- - max_w = upload.width(:precrop)
21
- - max_h = upload.height(:precrop)
22
- - image_w = max_w * 3 / 4
23
- - image_h = max_h * 3 / 4
24
- - image_l = (w - image_w)/2
25
- - image_t = (h - image_h)/2
26
-
27
- // scale_* will already be defined when editing an existing crop
28
- - scale_w = params[:scale_w] || image_w
29
- - scale_h = params[:scale_h] || image_h
30
- - offset_l = params[:offset_l] || image_l
31
- - offset_t = params[:offset_t] || image_t
32
-
33
- .cropper
34
- .preview{:style => "width: #{scale_w}px; height: #{scale_h}px; top: #{offset_t}px; left: #{offset_l}px"}
35
- %img{:src => upload.file.url(:precrop)}
36
-
37
- = fields_for recipient, object do |sf|
38
- %fieldset.crop
39
- = hidden_field_tag :multiplier, multiplier
40
- = sf.hidden_field :"#{prefix}_offset_left", :value => offset_l, :class => 'ol'
41
- = sf.hidden_field :"#{prefix}_offset_top", :value => offset_t, :class => 'ot'
42
- = sf.hidden_field :"#{prefix}_upload_id", :value => upload.id
43
- .scaler
44
- %p.range
45
- = sf.range_field :"#{prefix}_scale_width", :min => w, :max => max_w, :value => scale_w, :class => 'sw'
46
- = sf.hidden_field :"#{prefix}_scale_height", :value => scale_h, :class => 'sh'
@@ -1,24 +0,0 @@
1
- %p
2
- Dear
3
- = @resource.name + ','
4
-
5
- %p
6
- You are cordially invited to visit our new Data Room.
7
-
8
- %p
9
- The data room is a private space for the dissemination of useful information.
10
-
11
- %p
12
- An account has been created for you; all that remains is to activate it and choose a password.
13
-
14
- %h2
15
- = link_to "Please click here to begin", confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
16
-
17
- %p
18
- As always your comments and suggestions will be very welcome.
19
-
20
- %p
21
- With best wishes,
22
-
23
- %p
24
- = Droom.email_from_name
@@ -1,21 +0,0 @@
1
- %p
2
- Hello
3
- = @user.best_name + ','
4
-
5
- %p
6
- Someone, perhaps you, has entered your email address into the 'forgotten password' form in the data room.
7
-
8
- %p
9
- If that person was not you, please don't be concerned: you are receiving this message and they are not.
10
- Please ignore it and carry on as usual.
11
-
12
- %p
13
- If you would like to change your password, please click on the link below:
14
-
15
- %h2
16
- = link_to "Change your password here", edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)
17
-
18
- %p
19
- Your password will not change until you complete this process, so if you have just remembered it you can still
20
- = link_to "log in", new_user_session_url
21
- as usual.
@@ -1,9 +0,0 @@
1
- .search_results
2
- - if @results && @results.any?
3
- - @results.each do |result|
4
- = render :partial => "#{result.class.to_s.pluralize.underscore}/search_result", :object => result
5
-
6
- - elsif @fragment
7
- %li.error
8
- = t :no_results
9
- - with_info ||= false
@@ -1,18 +0,0 @@
1
- %h1.pagetitle
2
- Search
3
-
4
- %form.search_form{:action => droom.search_url}
5
- = text_field_tag :term, params[:term], :placeholder => t(:advanced_search), :autocomplete => "off", :class => "search_box"
6
- = submit_tag "search"
7
-
8
- = render :partial => 'droom/shared/search_results'
9
-
10
- %p.note
11
- This search works in a fairly google-like way. It is designed more for strength than sophistication,
12
- but your query can include modifiers like
13
- %strong +term
14
- and
15
- %strong -term
16
- to insist on the presence or absence of a word, and "phrases enclosed in double quotes" must occur intact.
17
- The index includes uploaded documents as well as our events and people.
18
-