concerto_weather 0.2.0 → 0.3.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 +4 -4
- data/README.md +2 -1
- data/app/models/weather.rb +6 -6
- data/app/views/contents/weather/_form_top.html.erb +2 -2
- data/app/views/contents/weather/_render_default.html.erb +1 -1
- data/app/views/contents/weather/_render_tile.html.erb +1 -1
- data/lib/concerto_weather/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 66dbd86c1fcd551ff92a1019010cc5642e8ef628
|
|
4
|
+
data.tar.gz: d6545a3861743532e2768736799713b469de392e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a612c4c53a755b0dc0a058e9ea9d822f8bd026e21c5557b553f21674654a29d9329c576152360bbfc1d05e92639f83b35cb25a9c93b1895f56a419e51e18d02
|
|
7
|
+
data.tar.gz: 68f382ef74de15dff7913521d3cecfc7535bff2729573a53040447b0b93f4d3d72bb2956c5dc6150384fac42bedae481aef63ef905b8b181bebff480d5e78aee
|
data/README.md
CHANGED
|
@@ -7,7 +7,8 @@ Concerto 2 Weather is licensed under the Apache License, Version 2.0.
|
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
1. Visit the plugin management page in Concerto, select RubyGems as the source and "concerto_weather" as the gem name.
|
|
10
|
-
2.
|
|
10
|
+
2. Visit the settings page (admin category on the nav bar) and enter your [OpenWeatherMap API key](http://openweathermap.org/appid) under the "API Keys" tab.
|
|
11
|
+
3. For any issues displaying the custom weather icons, make sure to precompile assets using:
|
|
11
12
|
|
|
12
13
|
(for production)
|
|
13
14
|
``` RAILS_ENV=production rake assets:precompile```
|
data/app/models/weather.rb
CHANGED
|
@@ -10,9 +10,9 @@ class Weather < DynamicContent
|
|
|
10
10
|
require 'json'
|
|
11
11
|
require 'net/http'
|
|
12
12
|
|
|
13
|
-
# Build request url
|
|
13
|
+
# Build request url
|
|
14
14
|
params = {
|
|
15
|
-
|
|
15
|
+
id: self.config['city_id'],
|
|
16
16
|
units: self.config['units'],
|
|
17
17
|
cnt: 1,
|
|
18
18
|
mode: 'json',
|
|
@@ -24,9 +24,8 @@ class Weather < DynamicContent
|
|
|
24
24
|
# Make request to OpenWeatherMapAPI
|
|
25
25
|
response = Net::HTTP.get_response(URI.parse(url)).body
|
|
26
26
|
data = JSON.parse(response)
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
# Build HTML using API data
|
|
29
|
-
#<img src='http://api.openweathermap.org/img/w/#{data['list'][0]['weather'][0]['icon']}' />
|
|
30
29
|
rawhtml = "
|
|
31
30
|
<h1> Today in #{data['city']['name']} </h1>
|
|
32
31
|
<div style='float: left; width: 50%'>
|
|
@@ -45,12 +44,13 @@ class Weather < DynamicContent
|
|
|
45
44
|
htmltext.name = "Today's weather in #{data['city']['name']}"
|
|
46
45
|
htmltext.data = rawhtml
|
|
47
46
|
|
|
47
|
+
self.config["location_name"] = data["city"]["name"]
|
|
48
48
|
return [htmltext]
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# Weather needs a location. Also allow specification of units
|
|
52
52
|
def self.form_attributes
|
|
53
53
|
attributes = super()
|
|
54
|
-
attributes.concat([:config => [:
|
|
54
|
+
attributes.concat([:config => [:city_id, :units, :location_name]])
|
|
55
55
|
end
|
|
56
|
-
end
|
|
56
|
+
end
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
<div class='span4'>
|
|
8
8
|
<%= form.fields_for :config do |config| %>
|
|
9
9
|
<div class="clearfix">
|
|
10
|
-
<%= config.label :
|
|
10
|
+
<%= config.label :city_id, "City ID" %>
|
|
11
11
|
<div class="input">
|
|
12
|
-
<%= config.text_field :
|
|
12
|
+
<%= config.text_field :city_id, placeholder: "1273294", value: @content.config['city_id'] %>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
15
|
<div class="clearfix">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<h1>Weather for <%= content.config['
|
|
1
|
+
<h1>Weather for <%= content.config['location_name'] %></h1>
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: concerto_weather
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brian Michalski
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-05-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
77
77
|
version: '0'
|
|
78
78
|
requirements: []
|
|
79
79
|
rubyforge_project:
|
|
80
|
-
rubygems_version: 2.
|
|
80
|
+
rubygems_version: 2.5.1
|
|
81
81
|
signing_key:
|
|
82
82
|
specification_version: 4
|
|
83
83
|
summary: Weather plugin for Concerto 2.
|