enju_bookmark 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,8 +43,7 @@ class BookmarkStatHasManifestationsController < ApplicationController
43
43
 
44
44
  respond_to do |format|
45
45
  if @bookmark_stat_has_manifestation.save
46
- flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.bookmark_stat_has_manifestation'))
47
- format.html { redirect_to(@bookmark_stat_has_manifestation) }
46
+ format.html { redirect_to @bookmark_stat_has_manifestation, :notice => t('controller.successfully_created', :model => t('activerecord.models.bookmark_stat_has_manifestation')) }
48
47
  format.json { render :json => @bookmark_stat_has_manifestation, :status => :created, :location => @bookmark_stat_has_manifestation }
49
48
  else
50
49
  format.html { render :action => "new" }
@@ -58,9 +57,8 @@ class BookmarkStatHasManifestationsController < ApplicationController
58
57
  def update
59
58
  respond_to do |format|
60
59
  if @bookmark_stat_has_manifestation.update_attributes(params[:bookmark_stat_has_manifestation])
61
- flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.bookmark_stat_has_manifestation'))
62
- format.html { redirect_to(@bookmark_stat_has_manifestation) }
63
- format.json { head :ok }
60
+ format.html { redirect_to @bookmark_stat_has_manifestation, :notice => t('controller.successfully_updated', :model => t('activerecord.models.bookmark_stat_has_manifestation')) }
61
+ format.json { head :no_content }
64
62
  else
65
63
  format.html { render :action => "edit" }
66
64
  format.json { render :json => @bookmark_stat_has_manifestation.errors, :status => :unprocessable_entity }
@@ -74,8 +72,8 @@ class BookmarkStatHasManifestationsController < ApplicationController
74
72
  @bookmark_stat_has_manifestation.destroy
75
73
 
76
74
  respond_to do |format|
77
- format.html { redirect_to(bookmark_stat_has_manifestations_url) }
78
- format.json { head :ok }
75
+ format.html { redirect_to bookmark_stat_has_manifestations_url }
76
+ format.json { head :no_content }
79
77
  end
80
78
  end
81
79
  end
@@ -48,8 +48,7 @@ class BookmarkStatsController < ApplicationController
48
48
 
49
49
  respond_to do |format|
50
50
  if @bookmark_stat.save
51
- flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.bookmark_stat'))
52
- format.html { redirect_to(@bookmark_stat) }
51
+ format.html { redirect_to @bookmark_stat, :notice => t('controller.successfully_created', :model => t('activerecord.models.bookmark_stat')) }
53
52
  format.json { render :json => @bookmark_stat, :status => :created, :location => @bookmark_stat }
54
53
  else
55
54
  format.html { render :action => "new" }
@@ -63,9 +62,8 @@ class BookmarkStatsController < ApplicationController
63
62
  def update
64
63
  respond_to do |format|
65
64
  if @bookmark_stat.update_attributes(params[:bookmark_stat])
66
- flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.bookmark_stat'))
67
- format.html { redirect_to(@bookmark_stat) }
68
- format.json { head :ok }
65
+ format.html { redirect_to @bookmark_stat, :notice => t('controller.successfully_updated', :model => t('activerecord.models.bookmark_stat')) }
66
+ format.json { head :no_content }
69
67
  else
70
68
  format.html { render :action => "edit" }
71
69
  format.json { render :json => @bookmark_stat.errors, :status => :unprocessable_entity }
@@ -79,8 +77,8 @@ class BookmarkStatsController < ApplicationController
79
77
  @bookmark_stat.destroy
80
78
 
81
79
  respond_to do |format|
82
- format.html { redirect_to(bookmark_stats_url) }
83
- format.json { head :ok }
80
+ format.html { redirect_to bookmark_stats_url }
81
+ format.json { head :no_content }
84
82
  end
85
83
  end
86
84
  end
@@ -3,7 +3,7 @@ class BookmarksController < ApplicationController
3
3
  before_filter :store_location
4
4
  load_and_authorize_resource :except => :index
5
5
  authorize_resource :only => :index
6
- before_filter :get_user_if_nil, :only => :index
6
+ before_filter :get_user, :only => :index
7
7
  after_filter :solr_commit, :only => [:create, :update, :destroy]
8
8
  cache_sweeper :bookmark_sweeper, :only => [:create, :update, :destroy]
9
9
 
@@ -71,7 +71,7 @@ class BookmarksController < ApplicationController
71
71
  end
72
72
  end
73
73
 
74
- # GET /bookmarks/1;edit
74
+ # GET /bookmarks/1/edit
75
75
  def edit
76
76
  end
77
77
 
@@ -87,10 +87,10 @@ class BookmarksController < ApplicationController
87
87
  @bookmark.manifestation.index!
88
88
  if params[:mode] == 'tag_edit'
89
89
  format.html { redirect_to(@bookmark.manifestation) }
90
- format.json { render :json => @bookmark, :status => :created, :location => bookmark_url(@bookmark) }
90
+ format.json { render :json => @bookmark, :status => :created, :location => @bookmark }
91
91
  else
92
92
  format.html { redirect_to(@bookmark) }
93
- format.json { render :json => @bookmark, :status => :created, :location => bookmark_url(@bookmark) }
93
+ format.json { render :json => @bookmark, :status => :created, :location => @bookmark }
94
94
  end
95
95
  else
96
96
  @user = current_user
@@ -118,11 +118,11 @@ class BookmarksController < ApplicationController
118
118
  @bookmark.create_tag_index
119
119
  case params[:mode]
120
120
  when 'tag_edit'
121
- format.html { redirect_to(@bookmark.manifestation) }
122
- format.json { head :ok }
121
+ format.html { redirect_to @bookmark.manifestation }
122
+ format.json { head :no_content }
123
123
  else
124
- format.html { redirect_to bookmark_url(@bookmark) }
125
- format.json { head :ok }
124
+ format.html { redirect_to @bookmark }
125
+ format.json { head :no_content }
126
126
  end
127
127
  else
128
128
  format.html { render :action => "edit" }
@@ -141,12 +141,12 @@ class BookmarksController < ApplicationController
141
141
  if @user
142
142
  respond_to do |format|
143
143
  format.html { redirect_to user_bookmarks_url(@user) }
144
- format.json { head :ok }
144
+ format.json { head :no_content }
145
145
  end
146
146
  else
147
147
  respond_to do |format|
148
148
  format.html { redirect_to user_bookmarks_url(@bookmark.user) }
149
- format.json { head :ok }
149
+ format.json { head :no_content }
150
150
  end
151
151
  end
152
152
  end
@@ -1,6 +1,6 @@
1
1
  class TagsController < ApplicationController
2
2
  load_and_authorize_resource
3
- before_filter :get_user_if_nil
3
+ before_filter :get_user
4
4
  after_filter :solr_commit, :only => [:create, :update, :destroy]
5
5
  cache_sweeper :bookmark_sweeper, :only => [:create, :update, :destroy]
6
6
 
@@ -35,9 +35,6 @@ class TagsController < ApplicationController
35
35
  end
36
36
 
37
37
  def show
38
- #@tag = Tag.find(params[:id])
39
- raise ActiveRecord::RecordNotFound if @tag.blank?
40
-
41
38
  respond_to do |format|
42
39
  format.html # show.html.erb
43
40
  format.json { render :json => @tag }
@@ -53,9 +50,8 @@ class TagsController < ApplicationController
53
50
 
54
51
  respond_to do |format|
55
52
  if @tag.update_attributes(params[:tag])
56
- flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.tag'))
57
- format.html { redirect_to tag_url(@tag.name) }
58
- format.json { head :ok }
53
+ format.html { redirect_to @tag, :notice => t('controller.successfully_updated', :model => t('activerecord.models.tag')) }
54
+ format.json { head :no_content }
59
55
  else
60
56
  format.html { render :action => "edit" }
61
57
  format.json { render :json => @tag.errors, :status => :unprocessable_entity }
@@ -70,8 +66,8 @@ class TagsController < ApplicationController
70
66
  @tag.destroy
71
67
 
72
68
  respond_to do |format|
73
- format.html { redirect_to(tags_url) }
74
- format.json { head :ok }
69
+ format.html { redirect_to tags_url }
70
+ format.json { head :no_content }
75
71
  end
76
72
  end
77
73
  end
@@ -19,7 +19,7 @@ class BookmarkStat < ActiveRecord::Base
19
19
  def calculate_count
20
20
  self.started_at = Time.zone.now
21
21
  Manifestation.find_each do |manifestation|
22
- daily_count = Bookmark.manifestations_count(self.start_date, self.end_date, manifestation)
22
+ daily_count = Bookmark.manifestations_count(start_date, end_date, manifestation)
23
23
  #manifestation.update_attributes({:daily_bookmarks_count => daily_count, :total_count => manifestation.total_count + daily_count})
24
24
  if daily_count > 0
25
25
  self.manifestations << manifestation
@@ -1,19 +1,14 @@
1
1
  class CreateBookmarkStats < ActiveRecord::Migration
2
- def self.up
2
+ def change
3
3
  create_table :bookmark_stats do |t|
4
4
  t.datetime :start_date
5
5
  t.datetime :end_date
6
- t.text :note
7
- t.string :state
8
6
  t.datetime :started_at
9
7
  t.datetime :completed_at
8
+ t.text :note
9
+ t.string :state
10
10
 
11
11
  t.timestamps
12
12
  end
13
- add_index :bookmark_stats, :state
14
- end
15
-
16
- def self.down
17
- drop_table :bookmark_stats
18
13
  end
19
14
  end
@@ -1,5 +1,5 @@
1
1
  class CreateBookmarkStatHasManifestations < ActiveRecord::Migration
2
- def self.up
2
+ def change
3
3
  create_table :bookmark_stat_has_manifestations do |t|
4
4
  t.integer :bookmark_stat_id, :null => false
5
5
  t.integer :manifestation_id, :null => false
@@ -10,8 +10,4 @@ class CreateBookmarkStatHasManifestations < ActiveRecord::Migration
10
10
  add_index :bookmark_stat_has_manifestations, :bookmark_stat_id
11
11
  add_index :bookmark_stat_has_manifestations, :manifestation_id
12
12
  end
13
-
14
- def self.down
15
- drop_table :bookmark_stat_has_manifestations
16
- end
17
13
  end
@@ -8,6 +8,7 @@ require 'friendly_id'
8
8
  require 'will_paginate'
9
9
  require 'addressable/uri'
10
10
  require 'nkf'
11
+ require 'acts_as_list'
11
12
 
12
13
  module EnjuBookmark
13
14
  class Engine < Rails::Engine
@@ -1,3 +1,3 @@
1
1
  module EnjuBookmark
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -48,7 +48,7 @@ class ApplicationController < ActionController::Base
48
48
  end
49
49
  end
50
50
 
51
- def get_user_if_nil
51
+ def get_user
52
52
  @user = User.where(:username => params[:user_id]).first if params[:user_id]
53
53
  #authorize! :show, @user if @user
54
54
  end
@@ -17,8 +17,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
17
17
  t.integer "bookmark_stat_id", :null => false
18
18
  t.integer "manifestation_id", :null => false
19
19
  t.integer "bookmarks_count"
20
- t.datetime "created_at"
21
- t.datetime "updated_at"
20
+ t.datetime "created_at", :null => false
21
+ t.datetime "updated_at", :null => false
22
22
  end
23
23
 
24
24
  add_index "bookmark_stat_has_manifestations", ["bookmark_stat_id"], :name => "index_bookmark_stat_has_manifestations_on_bookmark_stat_id"
@@ -27,16 +27,14 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
27
27
  create_table "bookmark_stats", :force => true do |t|
28
28
  t.datetime "start_date"
29
29
  t.datetime "end_date"
30
- t.text "note"
31
- t.string "state"
32
30
  t.datetime "started_at"
33
31
  t.datetime "completed_at"
34
- t.datetime "created_at"
35
- t.datetime "updated_at"
32
+ t.text "note"
33
+ t.string "state"
34
+ t.datetime "created_at", :null => false
35
+ t.datetime "updated_at", :null => false
36
36
  end
37
37
 
38
- add_index "bookmark_stats", ["state"], :name => "index_bookmark_stats_on_state"
39
-
40
38
  create_table "bookmarks", :force => true do |t|
41
39
  t.integer "user_id", :null => false
42
40
  t.integer "manifestation_id"
@@ -44,8 +42,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
44
42
  t.string "url"
45
43
  t.text "note"
46
44
  t.boolean "shared"
47
- t.datetime "created_at"
48
- t.datetime "updated_at"
45
+ t.datetime "created_at", :null => false
46
+ t.datetime "updated_at", :null => false
49
47
  end
50
48
 
51
49
  add_index "bookmarks", ["manifestation_id"], :name => "index_bookmarks_on_manifestation_id"
@@ -57,8 +55,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
57
55
  t.text "display_name"
58
56
  t.text "note"
59
57
  t.integer "position"
60
- t.datetime "created_at"
61
- t.datetime "updated_at"
58
+ t.datetime "created_at", :null => false
59
+ t.datetime "updated_at", :null => false
62
60
  end
63
61
 
64
62
  create_table "checkout_types", :force => true do |t|
@@ -66,8 +64,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
66
64
  t.text "display_name"
67
65
  t.text "note"
68
66
  t.integer "position"
69
- t.datetime "created_at"
70
- t.datetime "updated_at"
67
+ t.datetime "created_at", :null => false
68
+ t.datetime "updated_at", :null => false
71
69
  end
72
70
 
73
71
  add_index "checkout_types", ["name"], :name => "index_checkout_types_on_name"
@@ -77,8 +75,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
77
75
  t.text "display_name"
78
76
  t.text "note"
79
77
  t.integer "position"
80
- t.datetime "created_at"
81
- t.datetime "updated_at"
78
+ t.datetime "created_at", :null => false
79
+ t.datetime "updated_at", :null => false
82
80
  end
83
81
 
84
82
  create_table "content_types", :force => true do |t|
@@ -86,8 +84,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
86
84
  t.text "display_name"
87
85
  t.text "note"
88
86
  t.integer "position"
89
- t.datetime "created_at"
90
- t.datetime "updated_at"
87
+ t.datetime "created_at", :null => false
88
+ t.datetime "updated_at", :null => false
91
89
  end
92
90
 
93
91
  create_table "exemplifies", :force => true do |t|
@@ -95,8 +93,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
95
93
  t.integer "item_id", :null => false
96
94
  t.string "type"
97
95
  t.integer "position"
98
- t.datetime "created_at"
99
- t.datetime "updated_at"
96
+ t.datetime "created_at", :null => false
97
+ t.datetime "updated_at", :null => false
100
98
  end
101
99
 
102
100
  add_index "exemplifies", ["item_id"], :name => "index_exemplifies_on_item_id", :unique => true
@@ -106,8 +104,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
106
104
  create_table "item_has_use_restrictions", :force => true do |t|
107
105
  t.integer "item_id", :null => false
108
106
  t.integer "use_restriction_id", :null => false
109
- t.datetime "created_at"
110
- t.datetime "updated_at"
107
+ t.datetime "created_at", :null => false
108
+ t.datetime "updated_at", :null => false
111
109
  end
112
110
 
113
111
  add_index "item_has_use_restrictions", ["item_id"], :name => "index_item_has_use_restrictions_on_item_id"
@@ -118,8 +116,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
118
116
  t.string "item_identifier"
119
117
  t.integer "circulation_status_id", :default => 5, :null => false
120
118
  t.integer "checkout_type_id", :default => 1, :null => false
121
- t.datetime "created_at"
122
- t.datetime "updated_at"
119
+ t.datetime "created_at", :null => false
120
+ t.datetime "updated_at", :null => false
123
121
  t.datetime "deleted_at"
124
122
  t.integer "shelf_id", :default => 1, :null => false
125
123
  t.integer "basket_id"
@@ -178,8 +176,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
178
176
  t.integer "users_count", :default => 0, :null => false
179
177
  t.integer "position"
180
178
  t.integer "country_id"
181
- t.datetime "created_at"
182
- t.datetime "updated_at"
179
+ t.datetime "created_at", :null => false
180
+ t.datetime "updated_at", :null => false
183
181
  t.datetime "deleted_at"
184
182
  end
185
183
 
@@ -198,8 +196,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
198
196
  t.integer "valid_period_for_new_user", :default => 365, :null => false
199
197
  t.boolean "post_to_union_catalog", :default => false, :null => false
200
198
  t.integer "country_id"
201
- t.datetime "created_at"
202
- t.datetime "updated_at"
199
+ t.datetime "created_at", :null => false
200
+ t.datetime "updated_at", :null => false
203
201
  t.text "admin_networks"
204
202
  t.boolean "allow_bookmark_external_url", :default => false, :null => false
205
203
  t.integer "position"
@@ -216,8 +214,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
216
214
  t.string "manifestation_identifier"
217
215
  t.datetime "date_of_publication"
218
216
  t.datetime "copyright_date"
219
- t.datetime "created_at"
220
- t.datetime "updated_at"
217
+ t.datetime "created_at", :null => false
218
+ t.datetime "updated_at", :null => false
221
219
  t.datetime "deleted_at"
222
220
  t.string "access_address"
223
221
  t.integer "language_id", :default => 1, :null => false
@@ -254,10 +252,10 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
254
252
  t.integer "frequency_id", :default => 1, :null => false
255
253
  t.boolean "subscription_master", :default => false, :null => false
256
254
  t.string "pub_date"
255
+ t.string "edition_string"
257
256
  t.integer "volume_number"
258
257
  t.integer "issue_number"
259
258
  t.integer "serial_number"
260
- t.string "edition_string"
261
259
  end
262
260
 
263
261
  add_index "manifestations", ["access_address"], :name => "index_manifestations_on_access_address"
@@ -277,8 +275,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
277
275
  t.text "display_name"
278
276
  t.text "note"
279
277
  t.integer "position"
280
- t.datetime "created_at"
281
- t.datetime "updated_at"
278
+ t.datetime "created_at", :null => false
279
+ t.datetime "updated_at", :null => false
282
280
  end
283
281
 
284
282
  create_table "patrons", :force => true do |t|
@@ -294,8 +292,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
294
292
  t.string "full_name"
295
293
  t.text "full_name_transcription"
296
294
  t.text "full_name_alternative"
297
- t.datetime "created_at"
298
- t.datetime "updated_at"
295
+ t.datetime "created_at", :null => false
296
+ t.datetime "updated_at", :null => false
299
297
  t.datetime "deleted_at"
300
298
  t.string "zip_code_1"
301
299
  t.string "zip_code_2"
@@ -342,16 +340,16 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
342
340
  t.text "display_name"
343
341
  t.text "note"
344
342
  t.integer "position"
345
- t.datetime "created_at"
346
- t.datetime "updated_at"
343
+ t.datetime "created_at", :null => false
344
+ t.datetime "updated_at", :null => false
347
345
  end
348
346
 
349
347
  create_table "series_has_manifestations", :force => true do |t|
350
348
  t.integer "series_statement_id"
351
349
  t.integer "manifestation_id"
352
350
  t.integer "position"
353
- t.datetime "created_at"
354
- t.datetime "updated_at"
351
+ t.datetime "created_at", :null => false
352
+ t.datetime "updated_at", :null => false
355
353
  end
356
354
 
357
355
  add_index "series_has_manifestations", ["manifestation_id"], :name => "index_series_has_manifestations_on_manifestation_id"
@@ -365,8 +363,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
365
363
  t.integer "position"
366
364
  t.text "title_transcription"
367
365
  t.text "title_alternative"
368
- t.datetime "created_at"
369
- t.datetime "updated_at"
366
+ t.datetime "created_at", :null => false
367
+ t.datetime "updated_at", :null => false
370
368
  t.string "series_statement_identifier"
371
369
  t.string "issn"
372
370
  t.boolean "periodical"
@@ -384,8 +382,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
384
382
  t.integer "library_id", :default => 1, :null => false
385
383
  t.integer "items_count", :default => 0, :null => false
386
384
  t.integer "position"
387
- t.datetime "created_at"
388
- t.datetime "updated_at"
385
+ t.datetime "created_at", :null => false
386
+ t.datetime "updated_at", :null => false
389
387
  t.datetime "deleted_at"
390
388
  end
391
389
 
@@ -407,8 +405,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
407
405
  create_table "tags", :force => true do |t|
408
406
  t.string "name"
409
407
  t.string "name_transcription"
410
- t.datetime "created_at"
411
- t.datetime "updated_at"
408
+ t.datetime "created_at", :null => false
409
+ t.datetime "updated_at", :null => false
412
410
  end
413
411
 
414
412
  create_table "use_restrictions", :force => true do |t|
@@ -416,8 +414,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
416
414
  t.text "display_name"
417
415
  t.text "note"
418
416
  t.integer "position"
419
- t.datetime "created_at"
420
- t.datetime "updated_at"
417
+ t.datetime "created_at", :null => false
418
+ t.datetime "updated_at", :null => false
421
419
  end
422
420
 
423
421
  create_table "user_groups", :force => true do |t|
@@ -425,15 +423,15 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
425
423
  t.text "display_name"
426
424
  t.text "note"
427
425
  t.integer "position"
428
- t.datetime "created_at"
429
- t.datetime "updated_at"
426
+ t.datetime "created_at", :null => false
427
+ t.datetime "updated_at", :null => false
430
428
  end
431
429
 
432
430
  create_table "user_has_roles", :force => true do |t|
433
431
  t.integer "user_id"
434
432
  t.integer "role_id"
435
- t.datetime "created_at"
436
- t.datetime "updated_at"
433
+ t.datetime "created_at", :null => false
434
+ t.datetime "updated_at", :null => false
437
435
  end
438
436
 
439
437
  create_table "users", :force => true do |t|
@@ -442,8 +440,8 @@ ActiveRecord::Schema.define(:version => 20111231145823) do
442
440
  t.string "username"
443
441
  t.text "note"
444
442
  t.string "locale"
445
- t.datetime "created_at"
446
- t.datetime "updated_at"
443
+ t.datetime "created_at", :null => false
444
+ t.datetime "updated_at", :null => false
447
445
  t.string "email", :default => "", :null => false
448
446
  t.string "encrypted_password", :limit => 128, :default => "", :null => false
449
447
  t.string "reset_password_token"