rails_admin_tree_browser 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6541aa2a148b8e60bcac20dec52271d9f89ea0bc
4
- data.tar.gz: 6f0c79b9044f8b61719232b3897369a976ed2954
3
+ metadata.gz: 5334f640f177440d0fc32299e3edd31f311bda4c
4
+ data.tar.gz: 63d8024d397b4d17cced58bad22357b70032f105
5
5
  SHA512:
6
- metadata.gz: 310439b1aed54dac6d96851587ece69cbd6a800702e1c989e46670d38b30c5d27d7fe8f202f477f3440ae1a3a3a8b1ab480c8552532e3d77b981db0c46bcbadc
7
- data.tar.gz: 72a65838a73b1848d48223310fea18adb655256d9750e2fa43fe9768e90d1d82f11f70a7fd874f0ac0b05fe5480ba9bb1bc4ea2a447c7d11e3f2cccfc70c6134
6
+ metadata.gz: f8915cd793ef22c7d3f2dd7fe8e73d67f9d3e834e3de517724d5e963d0e5908c9ecce2e3a24bdaec0ecf1ae6ff45d5632dea1eaa9e02ce8c398c8b5bcf09ae08
7
+ data.tar.gz: 400abd81494bde65450293d7f0ba87525149b077350e1b6c52a4d52d50166b7006acc330490f99605eeea849ac18fb0d77b74195425c73cf507779ef799d3a7c
data/README.md CHANGED
@@ -7,7 +7,7 @@ A simple gem to work with [rails_admin](https://github.com/sferik/rails_admin) t
7
7
 
8
8
 
9
9
  ```ruby
10
- gem "rails_admin_browser_tree"
10
+ gem "rails_admin_tree_browser"
11
11
  ```
12
12
 
13
13
  Then, add in your rails admin model initializer<br/>
@@ -27,9 +27,10 @@ end
27
27
 
28
28
  ## Config
29
29
 
30
- - `tree_root_url` - The root url from where we show the files tree
31
- - `button_label` - Overwrite the label name (Optional)
30
+ - `tree_root_url` - The root url from where we show the tree
31
+ - `tree_download_url` - the download url from where we download the element, need to be download_link to true (Optional)
32
32
  - `download_link` - true/false Show icon with link to download (Optional)
33
+ - `button_label` - Overwrite the label name (Optional)
33
34
  - `node_type_name` - overwrite de node type name, default: node (Optional)
34
35
  - `element_type_name` - overwrite de element type name, default: element (Optional)
35
36
 
@@ -41,6 +42,7 @@ RailsAdmin.config do |config|
41
42
  edit do
42
43
  field :path, :tree_browser do
43
44
  tree_root_url 'https://url_to_api_return_json.com'
45
+ tree_download_url
44
46
  button_label 'Choose a file please'
45
47
  download_link true
46
48
  node_type_name 'dir'
@@ -8,6 +8,7 @@
8
8
  remove-button-label="<%= I18n.t('rails_admin_tree_browser.remove_button') %>"
9
9
  list-title-label="<%= I18n.t('rails_admin_tree_browser.list_title') %>"
10
10
  root-node="<%= field.tree_root_url %>"
11
+ download-url="<%= field.tree_download_url %>"
11
12
  button-label="<%= field.button_label %>"
12
13
  field-value="<%= @object[field.name] %>"
13
14
  field-name="<%= field.input_name %>"
@@ -15,6 +15,10 @@ module RailsAdmin::Config::Fields::Types
15
15
  nil
16
16
  end
17
17
 
18
+ register_instance_option(:tree_download_url) do
19
+ nil
20
+ end
21
+
18
22
  register_instance_option(:button_label) do
19
23
  I18n.t('rails_admin_tree_browser.choose_button') || :button_label
20
24
  end
@@ -29,7 +29,7 @@
29
29
  <a @click="changeNode(element.path)">{{ element.name }}</a>
30
30
  </div>
31
31
  </td>
32
- <td class="text-right" v-show="downloadLink">
32
+ <td class="text-right" v-if="downloadUrl && downloadLink">
33
33
  <a :href="downloadLinkPath(element)" download v-if="element.type === elementTypeName">
34
34
  <i class="fa fa-cloud-download"></i>
35
35
  </a>
@@ -65,6 +65,10 @@
65
65
  type: String,
66
66
  required: true
67
67
  },
68
+ downloadUrl: {
69
+ type: String,
70
+ required: false
71
+ },
68
72
  downloadLink: {
69
73
  type: Boolean,
70
74
  required: false
@@ -115,7 +119,7 @@
115
119
  },
116
120
  methods: {
117
121
  downloadLinkPath: function(element) {
118
- return this.rootNode + '/' + element.path
122
+ return this.downloadUrl + '/' + element.download_link
119
123
  },
120
124
  nodeClick: function(node) {
121
125
  this.selectedNode = node.path;
@@ -9778,7 +9778,7 @@
9778
9778
  /* moduleIdentifier (server only) */
9779
9779
  null
9780
9780
  )
9781
- Component.options.__file = "/Users/sebastien/Projects/port-of-quebec-intranet/vendor/gems/rails_admin_tree_browser/vendor/assets/javascripts/rails_admin/components/tree-browser.vue"
9781
+ Component.options.__file = "/Users/sebastien/Projects/rails_admin_tree_browser/vendor/assets/javascripts/rails_admin/components/tree-browser.vue"
9782
9782
  if (Component.esModule && Object.keys(Component.esModule).some(function (key) {return key !== "default" && key.substr(0, 2) !== "__"})) {console.error("named exports are not supported in *.vue files.")}
9783
9783
  if (Component.options.functional) {console.error("[vue-loader] tree-browser.vue: functional components are not supported with templates, they should use render functions.")}
9784
9784
 
@@ -10310,6 +10310,10 @@
10310
10310
  type: String,
10311
10311
  required: true
10312
10312
  },
10313
+ downloadUrl: {
10314
+ type: String,
10315
+ required: false
10316
+ },
10313
10317
  downloadLink: {
10314
10318
  type: Boolean,
10315
10319
  required: false
@@ -10361,7 +10365,7 @@
10361
10365
 
10362
10366
  methods: {
10363
10367
  downloadLinkPath: function downloadLinkPath(element) {
10364
- return this.rootNode + '/' + element.path;
10368
+ return this.downloadUrl + '/' + element.download_link;
10365
10369
  },
10366
10370
  nodeClick: function nodeClick(node) {
10367
10371
  this.selectedNode = node.path;
@@ -12254,13 +12258,7 @@
12254
12258
  _vm.changeNode(element.path)
12255
12259
  }
12256
12260
  }
12257
- }, [_vm._v(_vm._s(element.name))])]) : _vm._e()]), _vm._v(" "), _c('td', {
12258
- directives: [{
12259
- name: "show",
12260
- rawName: "v-show",
12261
- value: (_vm.downloadLink),
12262
- expression: "downloadLink"
12263
- }],
12261
+ }, [_vm._v(_vm._s(element.name))])]) : _vm._e()]), _vm._v(" "), (_vm.downloadUrl && _vm.downloadLink) ? _c('td', {
12264
12262
  staticClass: "text-right"
12265
12263
  }, [(element.type === _vm.elementTypeName) ? _c('a', {
12266
12264
  attrs: {
@@ -12269,7 +12267,7 @@
12269
12267
  }
12270
12268
  }, [_c('i', {
12271
12269
  staticClass: "fa fa-cloud-download"
12272
- })]) : _vm._e()])])
12270
+ })]) : _vm._e()]) : _vm._e()])
12273
12271
  }))])]) : _vm._e()])], 1)
12274
12272
  },staticRenderFns: []}
12275
12273
  module.exports.render._withStripped = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_admin_tree_browser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis-Philippe Dumas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-14 00:00:00.000000000 Z
12
+ date: 2017-12-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails