mongo_fe 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.
data/CHANGES.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.1.2 (2012-08-24)
2
+
3
+ * small UI improvement:
4
+ prettify the JSON documents and display them in a
5
+ modal window proportionally adjusted by the current
6
+ browser' window size.
7
+
1
8
  ## 0.1.1 (2012-07-18)
2
9
 
3
10
  * using agnostic-will_paginate
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongo_fe (0.1.1)
4
+ mongo_fe (0.1.2)
5
5
  agnostic-will_paginate (>= 3.0.0)
6
6
  bson
7
7
  bson_ext
@@ -30,7 +30,7 @@ GEM
30
30
  appraisal (0.4.1)
31
31
  bundler
32
32
  rake
33
- backports (2.6.1)
33
+ backports (2.6.2)
34
34
  bson (1.6.4)
35
35
  bson_ext (1.6.4)
36
36
  bson (~> 1.6.4)
@@ -33,11 +33,12 @@ $(function () {
33
33
 
34
34
  $('#edit-document').live('click', function () {
35
35
  var doc_id = $(this).data('id');
36
- var doc = $(this).data('doc');
37
-
36
+ var jsonString = $('#'+$(this).data('id')).html();
37
+ var doc = $.parseJSON(jsonString);
38
+
38
39
  $('#document-update-dialog .doc-id').html( "'"+doc_id+"'");
39
40
  $('#document-update-dialog .doc-id-field').attr( 'value', doc_id);
40
- $('#document-update-dialog .input-xlarge').attr( 'value', JSON.stringify(doc));
41
+ $('#document-update-dialog .input-xlarge').attr( 'value', JSON.stringify(doc, undefined, 2));
41
42
  });
42
43
 
43
44
  $('#json-doc-attributes').live('change', function() {
@@ -60,4 +61,23 @@ $(function () {
60
61
  }
61
62
  });
62
63
 
63
- });
64
+ $('#document-preview-dialog').on('show', function(){
65
+ $(this).css({
66
+ 'width': function () {
67
+ return ($(document).width() * .9) + 'px';
68
+ },
69
+ 'margin-left': function () {
70
+ return -($(this).width() / 2);
71
+ }
72
+ })
73
+ });
74
+
75
+ $('#preview-document').live('click', function() {
76
+ var jsonString = $('#'+$(this).data('id')).html();
77
+ if (jsonString) {
78
+ var prettyJSON = JSON.stringify($.parseJSON(jsonString), undefined, 4);
79
+ $('#document-preview-dialog .document-body').html(prettyJSON);
80
+ }
81
+ });
82
+
83
+ });
@@ -2,5 +2,5 @@
2
2
  # http://semver.org/
3
3
 
4
4
  module MongoFe
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.2"
6
6
  end
@@ -14,9 +14,11 @@
14
14
  %td(valign="top")
15
15
  %i.icon-arrow-right
16
16
  -json_attributes = doc.to_json
17
- %td(valign="top") #{json_attributes}
17
+ %td(valign="top" id="#{doc_id}") #{json_attributes}
18
18
  %td(valign="top" nowrap)
19
- %a#edit-document(href="#" data-id="#{doc_id}" data-toggle="modal" data-target="#document-update-dialog" data-doc="#{json_attributes}")
19
+ %a#preview-document(href="#" data-id="#{doc_id}" data-toggle="modal" data-target="#document-preview-dialog")
20
+ %i.icon-indent-left
21
+ %a#edit-document(href="#" data-id="#{doc_id}" data-toggle="modal" data-target="#document-update-dialog")
20
22
  %i.icon-pencil
21
23
  %a#confirm-delete-document(href="#" data-id="#{doc_id}" data-toggle="modal" data-target="#confirm-delete-document-dialog")
22
24
  %i.icon-remove
@@ -27,6 +29,16 @@
27
29
  %a.btn.btn-primary.btn-small(href="#new-document-modal" data-toggle="modal") add new document
28
30
 
29
31
 
32
+ #document-preview-dialog.modal.hide
33
+ .modal-header
34
+ %a.close(data-dismiss="modal")
35
+ %icon.icon-remove
36
+ %h3 Preview document
37
+ .modal-body
38
+ %pre.prettyprint.linenums.document-body
39
+ .modal-footer
40
+ %a.btn(href="#" data-dismiss="modal") Close
41
+
30
42
  #new-document-modal.modal.hide
31
43
  .modal-header
32
44
  %a.close(data-dismiss="modal")
@@ -41,7 +53,7 @@
41
53
  -# data-dismiss="modal"
42
54
  %button#new-document-modal-submit-button.btn.btn-primary.closeModal(type="submit") Save
43
55
 
44
- #document-update-dialog.modal.modal.hide
56
+ #document-update-dialog.modal.hide
45
57
  .modal-header
46
58
  %a.close(data-dismiss="modal")
47
59
  %icon.icon-remove
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_fe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-18 00:00:00.000000000 Z
12
+ date: 2012-08-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashie
@@ -538,12 +538,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
538
538
  - - ! '>='
539
539
  - !ruby/object:Gem::Version
540
540
  version: '0'
541
+ segments:
542
+ - 0
543
+ hash: -2156919542441712670
541
544
  required_rubygems_version: !ruby/object:Gem::Requirement
542
545
  none: false
543
546
  requirements:
544
547
  - - ! '>='
545
548
  - !ruby/object:Gem::Version
546
549
  version: '0'
550
+ segments:
551
+ - 0
552
+ hash: -2156919542441712670
547
553
  requirements: []
548
554
  rubyforge_project:
549
555
  rubygems_version: 1.8.24