frendms-rails 0.1.0 → 0.2.0

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: 7fa8eb3368bc807fbf368b087a7ccdcda1d616b9
4
- data.tar.gz: 3c4723051cca5750cb487c9492e12f57df158b44
3
+ metadata.gz: b3e3f98672eae3d9f518f416c77ab315a9b44fde
4
+ data.tar.gz: 11f47583bbeffe034fca369f0f63210f577e38fb
5
5
  SHA512:
6
- metadata.gz: 0e65eeec3ff6f68da76ba971ee77a25438d2a8d3e494845d582f5737c76bb662c419b5c34595ea0ff6168b640ec0afb55d651e362318a60cac12499f7341fc19
7
- data.tar.gz: 2cc25abb35556c456b37be3e37c575624359554e85437a89a7ac0ace397006024fa15c4c07bafe3c0cdab5eabbfe8f93f4d6fcb5df3dfaaaed106e5406c3a7b9
6
+ metadata.gz: 5a4cd1f2e8c318c7b1ac653dfa78ef98c99f7742abfbe53491c305c6ae7c1445bd5bc74ca5dbdcb48960ce9a7a9e2369bd3586acce9caa1cf026ee05a3f5da20
7
+ data.tar.gz: ae84dfeb5cda8b0f46fc412f9d068f8c413341fa55fe4eebb87ca9c6c27297d015a4631b3a5cdb9430712a9f887123ca825cad9946ce45f8ffa23ca3d947f5e2
data/README.md CHANGED
@@ -71,7 +71,7 @@ Example of an editable layout:
71
71
 
72
72
  ## Contributing
73
73
 
74
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/frendms-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
74
+ Bug reports and pull requests are welcome on GitHub at https://github.com/tysonholub/frendms-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
75
75
 
76
76
 
77
77
  ## License
@@ -4,19 +4,20 @@ module Frendms
4
4
  def get_elements
5
5
  e = Element.where('frender = ?', params[:frender])
6
6
  respond_to do |format|
7
- format.json { render :json => e.to_json(:only => [:elementId, :text]) }
7
+ format.json { render :json => e.to_json(:only => [:elementId, :elementIndex, :text]) }
8
8
  end
9
9
  end
10
10
 
11
11
  def update_element
12
12
  if user_signed_in?
13
- e = Element.find_by(:elementId => params[:id], :frender => params[:frender])
13
+ e = Element.find_by(:elementId => params[:id], :elementIndex => params[:index], :frender => params[:frender])
14
14
 
15
15
  if(params[:text].length > 0)
16
16
  if e.nil?
17
17
  e = Element.new
18
18
  e.frender = params[:frender]
19
19
  e.elementId = params[:id]
20
+ e.elementIndex = params[:index]
20
21
  end
21
22
  e.text = params[:text]
22
23
  e.save
@@ -3,10 +3,10 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "frendms-rails"
6
- s.version = "0.1.0"
6
+ s.version = "0.2.0"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
- # s.metadata = { "allowed_push_host" => "TODO: Set to 'http://mygemserver.com'" } if s.respond_to? :metadata=
9
+ s.metadata = { "allowed_push_host" => "https://rubygems.org" } if s.respond_to? :metadata=
10
10
  s.require_paths = ["lib"]
11
11
  s.authors = ["Tyson Holub"]
12
12
  s.bindir = "exe"
@@ -1,5 +1,5 @@
1
1
  module Frendms
2
2
  module Rails
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -2,6 +2,7 @@ class CreateElementsTable < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :elements do |t|
4
4
  t.string :elementId
5
+ t.integer :elementIndex
5
6
  t.string :frender
6
7
  t.text :text
7
8
 
@@ -8,18 +8,9 @@ function getElements(frender){
8
8
 
9
9
  },
10
10
  success : function(data) {
11
- console.log(data);
12
11
  $.each(data, function(i, element){
13
- if(element['elementId'].length > 1){
14
- $.each($(element['elementId']), function(j, inner){
15
- if($(inner).dompath().split(' ').length + 1 == element['elementId'].split(' ').length){
16
- $(inner).html(element['text'])
17
- }
18
- })
19
- } else {
20
- $(element['elementId']).html(element['text'])
21
- }
22
- })
12
+ $(element['elementId'])[element['elementIndex']].innerHTML = element['text'];
13
+ });
23
14
  $('.frend').show()
24
15
  },
25
16
  complete : function(data) {
@@ -36,11 +27,17 @@ function updateElement(element){
36
27
  element.parent().toggleClass('focused');
37
28
  var id = element.dompath().replace('.enabled', '');
38
29
  var text = element.val().trim();
30
+ var index = $(id).toArray().indexOf(element.parent()[0]);
39
31
  var frender = element.closest('.frender').attr('id');
40
32
 
41
33
  $.ajax({
42
34
  url : '/element/update',
43
- data : { frender : frender, text : text, id : id },
35
+ data : {
36
+ frender : frender,
37
+ text : text,
38
+ index : index,
39
+ id : id
40
+ },
44
41
  type : 'PUT',
45
42
  dataType : 'json',
46
43
  success : function(data) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frendms-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyson Holub
@@ -70,7 +70,8 @@ files:
70
70
  homepage: http://frendms.tysonholub.com
71
71
  licenses:
72
72
  - MIT
73
- metadata: {}
73
+ metadata:
74
+ allowed_push_host: https://rubygems.org
74
75
  post_install_message:
75
76
  rdoc_options: []
76
77
  require_paths:
@@ -87,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
88
  version: '0'
88
89
  requirements: []
89
90
  rubyforge_project:
90
- rubygems_version: 2.2.2
91
+ rubygems_version: 2.4.8
91
92
  signing_key:
92
93
  specification_version: 4
93
94
  summary: The Front End Management System