rails_admin_image_manager 0.1.15 → 0.1.20
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.
- checksums.yaml +4 -4
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/FontAwesome.otf +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/Simple-Line-Icons.eot +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/Simple-Line-Icons.svg +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/Simple-Line-Icons.ttf +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/Simple-Line-Icons.woff +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/fontawesome-webfont.eot +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/fontawesome-webfont.svg +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/fontawesome-webfont.ttf +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/fontawesome-webfont.woff +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/fontawesome-webfont.woff2 +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/glyphicons-halflings-regular.svg +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/{stylesheets/rails_admin_image_manager/fonts → fonts}/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/javascripts/rails_admin_image_manager/app-compiled.js.erb +16423 -358
- data/app/assets/javascripts/rails_admin_image_manager/app-vue.js +2 -0
- data/app/assets/javascripts/rails_admin_image_manager/components/imageInsertButton.vue +1 -1
- data/app/assets/javascripts/rails_admin_image_manager/components/imageListing.vue +32 -23
- data/app/assets/javascripts/rails_admin_image_manager/components/listingFilter.vue +32 -0
- data/app/assets/javascripts/rails_admin_image_manager/components/searchAutocomplete.vue +1 -0
- data/app/assets/javascripts/rails_admin_image_manager/filters/index.js +7 -0
- data/app/assets/javascripts/rails_admin_image_manager/libs/helpers.js +2 -0
- data/app/assets/javascripts/rails_admin_image_manager/stores/medias.js +12 -1
- data/app/assets/stylesheets/rails_admin_image_manager/_font.scss +2 -2
- data/app/assets/stylesheets/rails_admin_image_manager/global.css.erb +2 -2
- data/app/controllers/rails_admin_image_manager/application_controller.rb +1 -1
- data/app/controllers/rails_admin_image_manager/images_controller.rb +4 -1
- data/app/models/rails_admin_image_manager/file.rb +2 -0
- data/lib/rails_admin_image_manager/version.rb +1 -1
- metadata +19 -17
@@ -11,6 +11,8 @@ import progressOverlay from './components/progressOverlay.vue'
|
|
11
11
|
import notificationOverlay from './components/notificationOverlay.vue'
|
12
12
|
import confirmationOverlay from './components/confirmationOverlay.vue'
|
13
13
|
|
14
|
+
import './filters'
|
15
|
+
|
14
16
|
document.addEventListener("DOMContentLoaded", function() {
|
15
17
|
|
16
18
|
let csrfElement = document.querySelectorAll('meta[name="csrf-token"]')[0]
|
@@ -32,24 +32,41 @@
|
|
32
32
|
</div>
|
33
33
|
</div>
|
34
34
|
</div>
|
35
|
-
<div class="row
|
36
|
-
<div class="col-sm-12">
|
37
|
-
<button type="button" v-if="showMoreButton()" class="btn btn-default" @click="fetchImage">Plus d'image</button>
|
38
|
-
</div>
|
39
|
-
</div>
|
40
|
-
<div class="row items-push" v-if="!grid">
|
35
|
+
<div class="row items-push" v-if="!grid ">
|
41
36
|
<div class="table-responsive">
|
42
37
|
<table class="table table-striped table-vcenter">
|
38
|
+
<thead>
|
39
|
+
<tr>
|
40
|
+
<td width="110px">Image</td>
|
41
|
+
<td><listing-filter label="Titre" type="title" ></listing-filter></td>
|
42
|
+
<td width="140px"><listing-filter label="Ajouté le" type="date" ></listing-filter></td>
|
43
|
+
<td width="150px" class="text-center">Actions</td>
|
44
|
+
</tr>
|
45
|
+
</thead>
|
43
46
|
<tbody>
|
44
47
|
<tr v-for="(image, key) in imageListItems">
|
45
48
|
<td>
|
46
|
-
<img width="100px" :src="image.src" alt="">
|
49
|
+
<router-link :to="{ name: 'showImage', params: { id: image.id }}"><img width="100px" :src="image.src" alt=""></router-link>
|
50
|
+
</td>
|
51
|
+
<td>
|
52
|
+
{{image.name}}
|
53
|
+
</td>
|
54
|
+
<td>{{ image.created_at | formatDate }}</td>
|
55
|
+
<td class="text-right">
|
56
|
+
<image-insert-button :id="image.id"/>
|
57
|
+
<router-link class="btn btn-xs btn-default" :to="{ name: 'showImage', params: { id: image.id }}"><i class="fa fa-edit"></i></router-link>
|
58
|
+
<a class="btn btn-xs btn-default" @click="deleteImage(image)" href="javascript:void(0)"><i class="fa fa-trash-o"></i></a>
|
47
59
|
</td>
|
48
60
|
</tr>
|
49
61
|
</tbody>
|
50
62
|
</table>
|
51
63
|
</div>
|
52
64
|
</div>
|
65
|
+
<div class="row text-center items-push">
|
66
|
+
<div class="col-sm-12">
|
67
|
+
<button type="button" v-if="showMoreButton()" class="btn btn-default" @click="fetchImage">Plus d'image</button>
|
68
|
+
</div>
|
69
|
+
</div>
|
53
70
|
|
54
71
|
</div>
|
55
72
|
</div>
|
@@ -61,13 +78,15 @@
|
|
61
78
|
import imageInsertButton from './imageInsertButton.vue'
|
62
79
|
import imageTagSelector from './imageTagSelector.vue'
|
63
80
|
import searchAutocomplete from './searchAutocomplete.vue'
|
81
|
+
import listingFilter from './listingFilter.vue'
|
64
82
|
import Lazyload from '../libs/lazyload.js'
|
83
|
+
import { formatDate } from '../libs/helpers.js'
|
65
84
|
import {mapState} from 'vuex'
|
66
85
|
export default {
|
67
|
-
components: {imageInsertButton, imageTagSelector, searchAutocomplete},
|
86
|
+
components: {imageInsertButton, imageTagSelector, searchAutocomplete, listingFilter},
|
68
87
|
data () {
|
69
88
|
return {
|
70
|
-
grid:
|
89
|
+
grid: false,
|
71
90
|
lazyload: new Lazyload(()=> {
|
72
91
|
this.fetchImage()
|
73
92
|
}),
|
@@ -85,33 +104,21 @@ export default {
|
|
85
104
|
fetchImage() {
|
86
105
|
if (!this.isFetching && (this.maxImageListItems == -1 || this.imageListItems.length < this.maxImageListItems) ) {
|
87
106
|
this.isFetching = true
|
88
|
-
this.$store.dispatch('mediasStore/setSearchPage', this.page + 1)
|
107
|
+
this.$store.dispatch('mediasStore/setSearchPage', this.activeFilters.page + 1)
|
89
108
|
this.$store.dispatch('mediasStore/fetchImage').then(()=> {
|
90
109
|
this.isFetching = false
|
91
|
-
this.page ++
|
92
110
|
})
|
93
111
|
}
|
94
112
|
},
|
95
|
-
filter() {
|
96
|
-
console.log('filter');
|
97
|
-
},
|
98
|
-
search() {
|
99
|
-
this.page = 1
|
100
|
-
this.searchedQuery = (this.query == '') ? '' : this.query
|
101
|
-
this.$store.dispatch('mediasStore/clearImgListing')
|
102
|
-
this.$store.dispatch('mediasStore/setSearchQuery', this.query)
|
103
|
-
this.$store.dispatch('mediasStore/fetchImage')
|
104
|
-
},
|
105
113
|
showMoreButton() {
|
106
114
|
return (this.maxImageListItems > this.imageListItems.length && this.activeFilters.tags.length <= 0 && this.activeFilters.search == '')
|
107
115
|
},
|
108
116
|
resetSearchAndFilters() {
|
109
|
-
this.page = 1
|
110
117
|
this.query = ''
|
111
118
|
this.selectedFilter = ''
|
112
119
|
this.searchedQuery = ''
|
113
120
|
this.$store.dispatch('mediasStore/clearImgListing')
|
114
|
-
this.$store.dispatch('mediasStore/setSearchPage',
|
121
|
+
this.$store.dispatch('mediasStore/setSearchPage', 1)
|
115
122
|
this.$store.dispatch('mediasStore/fetchImage')
|
116
123
|
},
|
117
124
|
deleteImage(image){
|
@@ -132,6 +139,8 @@ export default {
|
|
132
139
|
</script>
|
133
140
|
|
134
141
|
<style media="screen" lang="sass">
|
142
|
+
.table > thead td
|
143
|
+
text-transform: uppercase
|
135
144
|
.add-image-link
|
136
145
|
margin-bottom: 15px
|
137
146
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<template>
|
2
|
+
<span class="listing-filter" @click.prevent="filter()">{{label}}
|
3
|
+
<i v-if="activeFilters[type] == 'ASC'" class="fa fa-arrow-down"></i>
|
4
|
+
<i v-if="activeFilters[type] == 'DESC'" class="fa fa-arrow-up"></i>
|
5
|
+
</span>
|
6
|
+
</template>
|
7
|
+
|
8
|
+
<script>
|
9
|
+
import {mapState} from 'vuex'
|
10
|
+
|
11
|
+
export default {
|
12
|
+
props: ['label', 'type'],
|
13
|
+
data () {
|
14
|
+
return {}
|
15
|
+
},
|
16
|
+
computed: {
|
17
|
+
...mapState('mediasStore', ['activeFilters'])
|
18
|
+
},
|
19
|
+
methods: {
|
20
|
+
filter () {
|
21
|
+
this.$store.dispatch('mediasStore/setSearchPage', 1)
|
22
|
+
this.$store.dispatch('mediasStore/clearImgListing')
|
23
|
+
this.$store.dispatch('mediasStore/toggleFilter', this.type)
|
24
|
+
this.$store.dispatch('mediasStore/fetchImage')
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
</script>
|
29
|
+
<style media="screen" lang="sass">
|
30
|
+
.listing-filter
|
31
|
+
cursor: pointer
|
32
|
+
</style>
|
@@ -70,6 +70,7 @@ export default {
|
|
70
70
|
queryArray[0] = this.filteredTags[this.selectedTagIndex].name
|
71
71
|
let newQuery = queryArray.reverse().join(' ')
|
72
72
|
this.$store.dispatch('mediasStore/setSearchQuery', '')
|
73
|
+
this.$store.dispatch('mediasStore/setSearchPage', 1)
|
73
74
|
this.$store.dispatch('mediasStore/clearImgListing')
|
74
75
|
this.$store.dispatch('mediasStore/addToTagFilter', this.filteredTags[this.selectedTagIndex].id)
|
75
76
|
this.$store.dispatch('mediasStore/fetchImage')
|
@@ -15,7 +15,9 @@ const mediasStore = {
|
|
15
15
|
activeFilters: {
|
16
16
|
tags: [],
|
17
17
|
search: '',
|
18
|
-
page: 1
|
18
|
+
page: 1,
|
19
|
+
date: '',
|
20
|
+
title: ''
|
19
21
|
},
|
20
22
|
tags: [],
|
21
23
|
errors: {}
|
@@ -96,6 +98,11 @@ const mediasStore = {
|
|
96
98
|
},
|
97
99
|
SET_QUERY(state, query){
|
98
100
|
state.activeFilters.search = query
|
101
|
+
},
|
102
|
+
SET_FILTER(state, opts){
|
103
|
+
state.activeFilters.date = ''
|
104
|
+
state.activeFilters.title = ''
|
105
|
+
state.activeFilters[opts[1]] = opts[0]
|
99
106
|
}
|
100
107
|
},
|
101
108
|
getters: {
|
@@ -285,6 +292,10 @@ const mediasStore = {
|
|
285
292
|
setSearchQuery({commit}, query) {
|
286
293
|
commit('SET_QUERY', query)
|
287
294
|
},
|
295
|
+
toggleFilter({commit, state}, type) {
|
296
|
+
let term = (state.activeFilters[type] == 'ASC') ? 'DESC' : 'ASC'
|
297
|
+
commit('SET_FILTER', [term, type])
|
298
|
+
},
|
288
299
|
clearImgListing({ commit }){
|
289
300
|
commit('CLEAR_IMG_LISTING')
|
290
301
|
},
|
@@ -6,8 +6,8 @@
|
|
6
6
|
* -------------------------- */
|
7
7
|
@font-face {
|
8
8
|
font-family: 'FontAwesome';
|
9
|
-
src: url('
|
10
|
-
src: url('
|
9
|
+
src: url("<%= font_path('fontawesome-webfont.eot?v=4.7.0') %>");
|
10
|
+
src: url("<%= font_path('fontawesome-webfont.eot?#iefix&v=4.7.0') %>") format('embedded-opentype'), url("<%= font_path('fontawesome-webfont.woff2?v=4.7.0') %>") format('woff2'), url("<%= font_path('fontawesome-webfont.woff?v=4.7.0') %>") format('woff'), url("<%= font_path('fontawesome-webfont.ttf?v=4.7.0') %>") format('truetype'), url("<%= font_path('fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') %>") format('svg');
|
11
11
|
font-weight: normal;
|
12
12
|
font-style: normal;
|
13
13
|
}
|
@@ -6,8 +6,8 @@
|
|
6
6
|
* -------------------------- */
|
7
7
|
@font-face {
|
8
8
|
font-family: 'FontAwesome';
|
9
|
-
src: url("
|
10
|
-
src: url("
|
9
|
+
src: url("<%= font_path('fontawesome-webfont.eot?v=4.7.0') %>");
|
10
|
+
src: url("<%= font_path('fontawesome-webfont.eot?#iefix&v=4.7.0') %>") format("embedded-opentype"), url("<%= font_path('fontawesome-webfont.woff2?v=4.7.0') %>") format("woff2"), url("<%= font_path('fontawesome-webfont.woff?v=4.7.0') %>") format("woff"), url("<%= font_path('fontawesome-webfont.ttf?v=4.7.0') %>") format("truetype"), url("<%= font_path('fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') %>") format("svg");
|
11
11
|
font-weight: normal;
|
12
12
|
font-style: normal;
|
13
13
|
}
|
@@ -8,9 +8,12 @@ module RailsAdminImageManager
|
|
8
8
|
}
|
9
9
|
|
10
10
|
format.json {
|
11
|
-
images = RailsAdminImageManager::File.select(:id, :name, :image_file_name).page(params[:page])
|
11
|
+
images = RailsAdminImageManager::File.select(:id, :name, :image_file_name, :created_at).page(params[:page])
|
12
12
|
images = images.filter_by_text(params[:search]) if filter_by?(:search)
|
13
13
|
images = images.filter_by_tags(params[:tags].map{|i| i.to_i }) if filter_by?(:tags)
|
14
|
+
images = images.order_by_date(params[:date]) if filter_by?(:date)
|
15
|
+
images = images.order_by_title(params[:title]) if filter_by?(:title)
|
16
|
+
|
14
17
|
images.each do |image|
|
15
18
|
image.src = image.image.url(:index)
|
16
19
|
end
|
@@ -34,6 +34,8 @@ module RailsAdminImageManager
|
|
34
34
|
|
35
35
|
scope :filter_by_text, -> (text) { where("image_manager_files.name LIKE ? OR image_manager_files.description LIKE ?", "%#{text}%", "%#{text}%") }
|
36
36
|
scope :filter_by_tags, -> (tags) { joins(:tags).where('image_manager_files_tags.image_manager_tag_id IN (?)', tags).distinct }
|
37
|
+
scope :order_by_date, -> (term) { order("created_at #{term}") }
|
38
|
+
scope :order_by_title, -> (term) { order("name #{term}") }
|
37
39
|
|
38
40
|
# == Instance Methods =====================================================
|
39
41
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_image_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iXmedia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -149,6 +149,21 @@ files:
|
|
149
149
|
- README.md
|
150
150
|
- Rakefile
|
151
151
|
- app/assets/config/rails_admin_image_manager_manifest.js
|
152
|
+
- app/assets/fonts/FontAwesome.otf
|
153
|
+
- app/assets/fonts/Simple-Line-Icons.eot
|
154
|
+
- app/assets/fonts/Simple-Line-Icons.svg
|
155
|
+
- app/assets/fonts/Simple-Line-Icons.ttf
|
156
|
+
- app/assets/fonts/Simple-Line-Icons.woff
|
157
|
+
- app/assets/fonts/fontawesome-webfont.eot
|
158
|
+
- app/assets/fonts/fontawesome-webfont.svg
|
159
|
+
- app/assets/fonts/fontawesome-webfont.ttf
|
160
|
+
- app/assets/fonts/fontawesome-webfont.woff
|
161
|
+
- app/assets/fonts/fontawesome-webfont.woff2
|
162
|
+
- app/assets/fonts/glyphicons-halflings-regular.eot
|
163
|
+
- app/assets/fonts/glyphicons-halflings-regular.svg
|
164
|
+
- app/assets/fonts/glyphicons-halflings-regular.ttf
|
165
|
+
- app/assets/fonts/glyphicons-halflings-regular.woff
|
166
|
+
- app/assets/fonts/glyphicons-halflings-regular.woff2
|
152
167
|
- app/assets/images/rails_admin_image_manager/image.png
|
153
168
|
- app/assets/javascripts/rails_admin_image_manager/app-compiled.js.erb
|
154
169
|
- app/assets/javascripts/rails_admin_image_manager/app-vue.js
|
@@ -162,10 +177,12 @@ files:
|
|
162
177
|
- app/assets/javascripts/rails_admin_image_manager/components/imageShow.vue
|
163
178
|
- app/assets/javascripts/rails_admin_image_manager/components/imageTagSelector.vue
|
164
179
|
- app/assets/javascripts/rails_admin_image_manager/components/imageUpload.vue
|
180
|
+
- app/assets/javascripts/rails_admin_image_manager/components/listingFilter.vue
|
165
181
|
- app/assets/javascripts/rails_admin_image_manager/components/notificationOverlay.vue
|
166
182
|
- app/assets/javascripts/rails_admin_image_manager/components/progressOverlay.vue
|
167
183
|
- app/assets/javascripts/rails_admin_image_manager/components/searchAutocomplete.vue
|
168
184
|
- app/assets/javascripts/rails_admin_image_manager/editor/image_manager_picker.js.erb
|
185
|
+
- app/assets/javascripts/rails_admin_image_manager/filters/index.js
|
169
186
|
- app/assets/javascripts/rails_admin_image_manager/libs/helpers.js
|
170
187
|
- app/assets/javascripts/rails_admin_image_manager/libs/lazyload.js
|
171
188
|
- app/assets/javascripts/rails_admin_image_manager/router/index.js
|
@@ -179,21 +196,6 @@ files:
|
|
179
196
|
- app/assets/javascripts/rails_admin_image_manager/vendors/underscore.min.js
|
180
197
|
- app/assets/stylesheets/rails_admin_image_manager/_font.scss
|
181
198
|
- app/assets/stylesheets/rails_admin_image_manager/application.css
|
182
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/FontAwesome.otf
|
183
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/Simple-Line-Icons.eot
|
184
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/Simple-Line-Icons.svg
|
185
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/Simple-Line-Icons.ttf
|
186
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/Simple-Line-Icons.woff
|
187
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/fontawesome-webfont.eot
|
188
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/fontawesome-webfont.svg
|
189
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/fontawesome-webfont.ttf
|
190
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/fontawesome-webfont.woff
|
191
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/fontawesome-webfont.woff2
|
192
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/glyphicons-halflings-regular.eot
|
193
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/glyphicons-halflings-regular.svg
|
194
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/glyphicons-halflings-regular.ttf
|
195
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/glyphicons-halflings-regular.woff
|
196
|
-
- app/assets/stylesheets/rails_admin_image_manager/fonts/glyphicons-halflings-regular.woff2
|
197
199
|
- app/assets/stylesheets/rails_admin_image_manager/global.css.erb
|
198
200
|
- app/assets/stylesheets/rails_admin_image_manager/global.sass
|
199
201
|
- app/assets/stylesheets/rails_admin_image_manager/vendors/bootstrap.min.css
|