triannon 0.3.1 → 0.3.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: 9a7823282b8cd47ddb17f44857294cfad6766d9d
4
- data.tar.gz: cd3260e1d1f0a2d34b037cd859ece24db463eefc
3
+ metadata.gz: c07f371ee48e9009a0939488713930cf86ceb374
4
+ data.tar.gz: 8c8fcd9dd0f6df80a1c254894cd34090a4f96bcc
5
5
  SHA512:
6
- metadata.gz: 88a2eaa45c4eedf68f168b3077e767b6ec4a8e3278acba9a697e716ac05e7430e97b4608fc82e4d0a05c8cdb38908761a6cec8f16b6666d5ea1c89fa16753d03
7
- data.tar.gz: c1ecd934d10e4dc3d8f2916aa74ebf0a46866597cbc07f5b715fe009524fce0cae1f5a4a318d1400e1b865b587c679c61e4c6d13575dfcb4de73a25b36c5fb1a
6
+ metadata.gz: d8a3a250a33f946a1c9704af4fcd554bacb7154fb804457de64df9d948a0210365c0072261bede0ac3c6904e732881a0a71811fdaaa05d3bede2f6144a497aa5
7
+ data.tar.gz: c86be08cdcab1acfc2a2ce32ffe6374ac0bac1813c715862f2d33c18d2e07b9400c84b311bfb22ca8e65701d3c5f1dd6f7360e323d4ba246c4bd1915f8f18e7e
@@ -42,8 +42,18 @@ module Triannon
42
42
 
43
43
  # POST /annotations/annotations
44
44
  def create
45
- @annotation = Annotation.new(:data => request.body.read)
46
-
45
+ # FIXME: this is probably a bad way of allowing app form to be used as well as direct post requests
46
+ if params["annotation"]
47
+ # it's from app html form
48
+ params.require(:annotation).permit(:data)
49
+ if params["annotation"]["data"]
50
+ @annotation = Annotation.new({:data => params["annotation"]["data"]})
51
+ end
52
+ else
53
+ # it's a direct post request
54
+ @annotation = Annotation.new(:data => request.body.read)
55
+ end
56
+
47
57
  if @annotation.save
48
58
  redirect_to @annotation, notice: 'Annotation was successfully created.'
49
59
  else
@@ -53,7 +63,7 @@ module Triannon
53
63
 
54
64
  # PATCH/PUT /annotations/annotations/1
55
65
  def update
56
- if @annotation.update(annotation_params)
66
+ if @annotation.update(params)
57
67
  redirect_to @annotation, notice: 'Annotation was successfully updated.'
58
68
  else
59
69
  render :edit
@@ -71,7 +81,7 @@ module Triannon
71
81
  def set_annotation
72
82
  @annotation = Annotation.find(params[:id])
73
83
  end
74
-
84
+
75
85
  def default_format_jsonld
76
86
  if ((!request.accept || request.accept.empty?) && (!params[:format] || params[:format].empty?))
77
87
  request.format = "jsonld"
@@ -12,7 +12,7 @@
12
12
  <% end %>
13
13
 
14
14
  <div class="field">
15
- <%= f.label 'data (as json-ld or turtle)' %><br>
15
+ <%= f.label 'Annotation (as json-ld or turtle)' %><br>
16
16
  <%= f.text_area :data, size: "80x20" %>
17
17
  </div>
18
18
  <div class="actions">
@@ -1,3 +1,3 @@
1
1
  module Triannon
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: triannon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-24 00:00:00.000000000 Z
12
+ date: 2014-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails