character 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebbe449c413e59e85c65bfafa3077bb7590c6e15
4
- data.tar.gz: 786aceb734fec4d784850e7ba9491c76165a669a
3
+ metadata.gz: 458133239b35522811a9d45e7a7aa6dc23d2550b
4
+ data.tar.gz: cd08086e12ecd53d63cb270a750837a4c757d31d
5
5
  SHA512:
6
- metadata.gz: bcf91980c14c9d1cab7bfb69b494b7bd99a6df6b46c0dd1cace469791286d0615a4f356dfb93202c41530afb4e29ba609aca5c9f65e6123c9c7151b600663f02
7
- data.tar.gz: dc01417f750d2f385587bf8ad86c641e3e88b3b234dc8f936f859a59033e1e77c50e07ae4da321b8782672055e5bb74352c6f922c02347a8423c5e90b913a4a4
6
+ metadata.gz: d48c04a9f210fda478393335b4e0a2a33154f5002c347915d788c5187239e4f180026e0d43d9508dd41693e6783a9a049e13e6c5b5fff1dc02812b1999be7a6f
7
+ data.tar.gz: bb77c36d5b7e60d9daf2349d4953cf828d068ad63adcdd3676cf1e3ee66a386a30ec6d926feddb5ca70a5e3cdfb8cf72de6457614e1b3d388726970d0befd507
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  .DS_Store
2
2
 
3
3
  /log/*.log
4
- Gemfile.lock
4
+ Gemfile.lock
5
+ pkg
@@ -48,6 +48,7 @@
48
48
  <input id=chr_images_upload class='chr-images-upload' type='file' name='character_image[image]' multiple='' />
49
49
  Upload files...
50
50
  </div>
51
+ <button id=chr_images_delete class='button chr-images-delete'>Delete</button>
51
52
  </footer>
52
53
  </div>"""
53
54
 
@@ -56,6 +57,7 @@
56
57
  uploadInput: '#chr_images_upload'
57
58
  listContent: '#chr_images_grid'
58
59
  insertButton: '#chr_images_insert'
60
+ deleteButton: '#chr_images_delete'
59
61
 
60
62
  regions:
61
63
  listContent: '#chr_images_grid'
@@ -65,6 +67,7 @@
65
67
  'click #chr_images_cancel': '_cancel'
66
68
  'click #chr_images_insert': '_insert'
67
69
  'click #chr_images_grid li': '_selectImage'
70
+ 'click #chr_images_delete': '_deleteImage'
68
71
 
69
72
  initialize: ->
70
73
  @uploads = {}
@@ -95,6 +98,21 @@
95
98
  $el.toggleClass 'selected'
96
99
  @ui.insertButton.removeClass 'disabled'
97
100
 
101
+ @ui.deleteButton.show()
102
+
103
+ _deleteImage: (e) ->
104
+ if confirm("""Delete selected image?""")
105
+ imageId = @ui.listContent.find('.selected').attr('data-id')
106
+ @removeImageModel(imageId)
107
+
108
+ @ui.deleteButton.hide()
109
+
110
+ removeImageModel: (id) ->
111
+ imageModel = @collection.get(id)
112
+ @collection.remove(imageModel)
113
+
114
+ $.post "#{ chr.options.url }/Character-Image/#{id}", { 'character_image[hidden]': 'true' }, ->
115
+
98
116
  onRender: ->
99
117
  dialogWidth = Math.floor(($(window).width() - 322) / 176 ) * 176 + 20
100
118
  @ui.dialog.css { 'margin-left': dialogWidth / -2, 'width': dialogWidth }
@@ -103,6 +121,8 @@
103
121
  @listContent.show(@list)
104
122
 
105
123
  show: (@callback, @multipleSelection) ->
124
+ @ui.deleteButton.hide()
125
+
106
126
  # https://github.com/blueimp/jQuery-File-Upload/wiki/Options
107
127
  @ui.uploadInput.fileupload
108
128
  url: '/admin/Character-Image'
@@ -132,6 +152,8 @@ chr.module 'images', (module) ->
132
152
  @collection = new Character.Generic.Collection()
133
153
  @collection.options =
134
154
  collectionUrl: "#{ chr.options.url }/Character-Image"
155
+ where: 'hidden=false'
156
+
135
157
  @collection.sortField = 'created_at'
136
158
  @collection.sortDirection = 'desc'
137
159
  @collection.fetchPage(1)
@@ -933,6 +933,8 @@ b, strong { font-weight: $font_bold;
933
933
  }
934
934
  }
935
935
 
936
+ .chr-images-delete { top: -33px; margin-left: 130px; }
937
+
936
938
  .placeholder.csspinner.double-up:after { border-color: $list_border_color; }
937
939
  .placeholder.csspinner:before { background-color: transparent; }
938
940
 
@@ -1,6 +1,7 @@
1
1
  class Character::Image
2
2
  include Mongoid::Document
3
3
  include Mongoid::Timestamps
4
+ include Hideable
4
5
 
5
6
  mount_uploader :image, Character::ImageUploader
6
7
 
@@ -1,3 +1,3 @@
1
1
  module Character
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: character
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kravets
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-07-07 00:00:00.000000000 Z
14
+ date: 2014-07-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails