cloudstrg 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,9 @@ module Cloudstrg
9
9
  # GET /configs.json
10
10
  def index
11
11
  @config = @user.cloudstrgconfig
12
+ if params.has_key? :redirection_url
13
+ @redirection_url = params[:redirection_url]
14
+ end
12
15
 
13
16
  respond_to do |format|
14
17
  format.html # index.html.erb
@@ -9,6 +9,11 @@ module Cloudstrg
9
9
  # GET /configs.json
10
10
  def index
11
11
  @config = @user.cloudstrgconfig
12
+ if params.has_key? :redirection_url
13
+ puts params[:redirection_url]
14
+ @redirection_url = params[:redirection_url]
15
+ end
16
+ puts "Qui"
12
17
 
13
18
  respond_to do |format|
14
19
  format.html # index.html.erb
@@ -32,7 +37,7 @@ module Cloudstrg
32
37
  def new
33
38
  @config = @user.cloudstrgconfig
34
39
  if not @config
35
- @config = @user.cloudstrgconfig.build_cloudstrgconfig
40
+ @config = @user.build_cloudstrgconfig
36
41
  end
37
42
  @driver_list = CloudStrg.driver_list
38
43
 
@@ -51,7 +56,7 @@ module Cloudstrg
51
56
  # POST /configs
52
57
  # POST /configs.json
53
58
  def create
54
- @config = @user.cloudstrgconfig.build_cloudstrgconfig(params[:config])
59
+ @config = @user.build_cloudstrgconfig(params[:config])
55
60
  @driver_list = CloudStrg.driver_list
56
61
 
57
62
  respond_to do |format|
@@ -4,8 +4,6 @@ module Cloudstrg
4
4
 
5
5
  belongs_to :cloudstrgplugin, :class_name => Cloudstrg::Cloudstrgplugin
6
6
 
7
- has_many :remoteobjects, :class_name => Cloudstrg::Remoteobject, :dependent => :destroy
8
-
9
7
  belongs_to :user, :class_name => Cloudstrg.user_class
10
8
  end
11
9
  end
@@ -4,6 +4,8 @@ module Cloudstrg
4
4
 
5
5
  belongs_to :cloudstrgplugin, :class_name => Cloudstrg::Cloudstrgplugin
6
6
 
7
+ #has_many :remoteobjects, :class_name => Cloudstrg::Remoteobject, :dependent => :destroy
8
+
7
9
  belongs_to :user, :class_name => Cloudstrg.user_class
8
10
  end
9
11
  end
@@ -26,4 +26,8 @@
26
26
  <%= link_to 'New Config', new_config_path %>
27
27
  |
28
28
  <% end %>
29
- <%= link_to 'Back', main_app.scenes_path %>
29
+ <% if @redirection_url %>
30
+ <%= link_to 'Back', @redirection_url %>
31
+ <% else %>
32
+ <%= link_to 'Back', main_app.scenes_path %>
33
+ <% end %>
@@ -26,4 +26,4 @@
26
26
  <%= link_to 'New Config', new_config_path %>
27
27
  |
28
28
  <% end %>
29
- <%= link_to 'Index', main_app.scenes_path %>
29
+ <%= link_to 'Back', main_app.scenes_path %>
@@ -8,6 +8,10 @@
8
8
  </head>
9
9
  <body>
10
10
 
11
+ <% if params[:notice] %>
12
+ <p><%= params[:notice] %></p>
13
+ <% end %>
14
+
11
15
  <%= yield %>
12
16
 
13
17
  </body>
@@ -120,14 +120,16 @@ module CloudStrg
120
120
  end
121
121
 
122
122
  def save_remoteobject(user, filename, filecontent, file_remote_id)
123
- #plugin_name = self.class.to_s.split('Strg')[0].downcase
123
+ plugin_name = self.class.to_s.split('Strg')[0].downcase
124
+ puts plugin_name
125
+ plugin = Cloudstrg::Cloudstrgplugin.find_by_plugin_name(plugin_name)
124
126
 
125
- file = Cloudstrg::Remoteobject.where(:user_id => user, :cloudstrgplugin_id => user.cloudstrgconfig.cloudstrgplugin, :filename => filename)
127
+ file = Cloudstrg::Remoteobject.where(:user_id => user, :cloudstrgplugin_id => plugin, :filename => filename)
126
128
  if not file.empty?
127
129
  file = file[0]
128
130
  file.filehash = filecontent.hash.to_s
129
131
  else
130
- file = user.cloudstrgconfig.cloudstrgplugin.remotes.build(:user_id => user, :filename => filename, :filehash => filecontent.hash.to_s, :file_remote_id => file_remote_id)
132
+ file = plugin.remotes.build(:user_id => user, :filename => filename, :filehash => filecontent.hash.to_s, :file_remote_id => file_remote_id)
131
133
  end
132
134
  file.save
133
135
  return file
@@ -120,14 +120,16 @@ module CloudStrg
120
120
  end
121
121
 
122
122
  def save_remoteobject(user, filename, filecontent, file_remote_id)
123
- #plugin_name = self.class.to_s.split('Strg')[0].downcase
123
+ plugin_name = self.class.to_s.split('Strg')[0].downcase
124
+ puts plugin_name
125
+ plugin = Cloudstrg::Cloudstrgplugin.find_by_name(plugin_name)
124
126
 
125
- file = Cloudstrg::Remoteobject.where(:user_id => user, :cloudstrgplugin_id => user.cloudstrgconfig.cloudstrgplugin, :filename => filename)
127
+ file = Cloudstrg::Remoteobject.where(:user_id => user, :cloudstrgplugin_id => plugin, :filename => filename)
126
128
  if not file.empty?
127
129
  file = file[0]
128
130
  file.filehash = filecontent.hash.to_s
129
131
  else
130
- file = user.cloudstrgconfig.cloudstrgplugin.remotes.build(:user_id => user, :filename => filename, :filehash => filecontent.hash.to_s, :file_remote_id => file_remote_id)
132
+ file = plugin.remotes.build(:user_id => user, :filename => filename, :filehash => filecontent.hash.to_s, :file_remote_id => file_remote_id)
131
133
  end
132
134
  file.save
133
135
  return file
@@ -1,3 +1,3 @@
1
1
  module Cloudstrg
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstrg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
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-11-21 00:00:00.000000000 Z
12
+ date: 2012-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails