Skip to content
Browse files

Tidy up and fix some of the more obvious bugs

  • Loading branch information...
1 parent 179fe14 commit 06ef607b7bf84afb298c2d686a1bba7cc665cf08 @mchapman committed Apr 22, 2012
View
222 .idea/workspace.xml
@@ -3,7 +3,12 @@
<component name="ChangeListManager">
<list default="true" id="b040972b-81a1-4da9-949e-6b0e7181157d" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/assets/javascripts/index.js" afterPath="$PROJECT_DIR$/app/assets/javascripts/index.js" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/controllers/welcome_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/welcome_controller.rb" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/helpers/welcome_helper.rb" afterPath="$PROJECT_DIR$/app/helpers/welcome_helper.rb" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/layouts/application.html.erb" afterPath="$PROJECT_DIR$/app/views/layouts/application.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/welcome/opensource.html.erb" afterPath="$PROJECT_DIR$/app/views/welcome/opensource.html.erb" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/welcome/privacy.html.erb" afterPath="$PROJECT_DIR$/app/views/welcome/privacy.html.erb" />
</list>
<ignored path="cycle2work.iws" />
<ignored path=".idea/workspace.xml" />
@@ -28,16 +33,16 @@
<file leaf-file-name="calculate.html.erb" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/views/welcome/calculate.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="3" column="0" selection-start="244" selection-end="244" vertical-scroll-proportion="0.0">
+ <state line="0" column="0" selection-start="0" selection-end="114" vertical-scroll-proportion="-0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="welcome_helper.rb" pinned="false" current="false" current-in-tab="false">
+ <file leaf-file-name="welcome_helper.rb" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/helpers/welcome_helper.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="24" column="40" selection-start="863" selection-end="863" vertical-scroll-proportion="0.0">
+ <state line="16" column="38" selection-start="634" selection-end="634" vertical-scroll-proportion="0.46197182">
<folding />
</state>
</provider>
@@ -46,16 +51,25 @@
<file leaf-file-name="welcome_controller.rb" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/controllers/welcome_controller.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="87" column="0" selection-start="3076" selection-end="3076" vertical-scroll-proportion="0.0">
+ <state line="26" column="100" selection-start="1194" selection-end="1194" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="opensource.html.erb" pinned="false" current="true" current-in-tab="true">
+ <file leaf-file-name="privacy.html.erb" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/app/views/welcome/privacy.html.erb">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="96" selection-start="96" selection-end="96" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="opensource.html.erb" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/views/welcome/opensource.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="16" selection-start="16" selection-end="16" vertical-scroll-proportion="0.0">
+ <state line="0" column="58" selection-start="58" selection-end="58" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
@@ -64,7 +78,7 @@
<file leaf-file-name="index.html.erb" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/views/welcome/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="1" column="16" selection-start="34" selection-end="34" vertical-scroll-proportion="-0.625">
+ <state line="1" column="16" selection-start="34" selection-end="34" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
@@ -73,7 +87,7 @@
<file leaf-file-name="application.html.erb" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/views/layouts/application.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="26" column="19" selection-start="1018" selection-end="1018" vertical-scroll-proportion="-16.25">
+ <state line="28" column="11" selection-start="1384" selection-end="1384" vertical-scroll-proportion="-13.0">
<folding />
</state>
</provider>
@@ -91,7 +105,7 @@
<file leaf-file-name="index.js" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/assets/javascripts/index.js">
<provider selected="true" editor-type-id="text-editor">
- <state line="108" column="0" selection-start="4155" selection-end="4155" vertical-scroll-proportion="0.0">
+ <state line="107" column="0" selection-start="4017" selection-end="4017" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
@@ -112,26 +126,27 @@
</component>
<component name="HighlightingSettingsPerFile">
<setting file="mock:///IRB console" root0="SKIP_HIGHLIGHTING" />
+ <setting file="mock:///Rails console: cycle2work" root0="SKIP_HIGHLIGHTING" />
</component>
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
<option value="$PROJECT_DIR$/app/views/welcome/terms.html.erb" />
- <option value="$PROJECT_DIR$/app/views/welcome/privacy.html.erb" />
<option value="$PROJECT_DIR$/app/helpers/application_helper.rb" />
<option value="$PROJECT_DIR$/config/routes.rb" />
<option value="$PROJECT_DIR$/app/assets/javascripts/welcome.js.coffee" />
<option value="$PROJECT_DIR$/app/assets/javascripts/bootstrap.js.coffee" />
<option value="$PROJECT_DIR$/app/assets/stylesheets/welcome.css.scss" />
- <option value="$PROJECT_DIR$/app/assets/javascripts/index.js" />
<option value="$PROJECT_DIR$/app/views/welcome/index.html.erb" />
<option value="$PROJECT_DIR$/Gemfile" />
- <option value="$PROJECT_DIR$/app/views/layouts/application.html.erb" />
<option value="$PROJECT_DIR$/lib/metoffice.rb" />
- <option value="$PROJECT_DIR$/app/controllers/welcome_controller.rb" />
<option value="$PROJECT_DIR$/app/views/welcome/calculate.html.erb" />
- <option value="$PROJECT_DIR$/app/helpers/welcome_helper.rb" />
+ <option value="$PROJECT_DIR$/app/views/layouts/application.html.erb" />
<option value="$PROJECT_DIR$/app/views/welcome/opensource.html.erb" />
+ <option value="$PROJECT_DIR$/app/views/welcome/privacy.html.erb" />
+ <option value="$PROJECT_DIR$/app/assets/javascripts/index.js" />
+ <option value="$PROJECT_DIR$/app/controllers/welcome_controller.rb" />
+ <option value="$PROJECT_DIR$/app/helpers/welcome_helper.rb" />
</list>
</option>
</component>
@@ -143,9 +158,10 @@
<option name="CUSTOM_FILTER" />
</component>
<component name="ProjectFrameBounds">
- <option name="x" value="1365" />
- <option name="width" value="1682" />
- <option name="height" value="1055" />
+ <option name="x" value="-1" />
+ <option name="y" value="24" />
+ <option name="width" value="1368" />
+ <option name="height" value="725" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<OptionsSetting value="true" id="Add" />
@@ -181,30 +197,6 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
</PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="cycle2work" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="cycle2work" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
- <PATH>
- <PATH_ELEMENT>
- <option name="myItemId" value="cycle2work" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="cycle2work" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="app" />
- <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
- </PATH_ELEMENT>
- </PATH>
</subPane>
</pane>
<pane id="RailsProjectView">
@@ -518,10 +510,6 @@
<option name="myItemId" value="Controllers" />
<option name="myItemType" value="org.jetbrains.plugins.ruby.rails.projectView.v2.nodes.folders.ControllersFolderNode" />
</PATH_ELEMENT>
- <PATH_ELEMENT>
- <option name="myItemId" value="WelcomeController" />
- <option name="myItemType" value="org.jetbrains.plugins.ruby.rails.projectView.v2.nodes.ControllerClassNode" />
- </PATH_ELEMENT>
</PATH>
</subPane>
</pane>
@@ -531,14 +519,14 @@
<component name="PropertiesComponent">
<property name="options.splitter.main.proportions" value="0.3" />
<property name="WebServerToolWindowFactoryState" value="false" />
- <property name="recentsLimit" value="5" />
<property name="options.lastSelected" value="preferences.sourceCode.General" />
+ <property name="recentsLimit" value="5" />
<property name="RailsGeneratorsPopup.hiddenIncluded" value="false" />
- <property name="GoToClass.includeJavaFiles" value="false" />
- <property name="Ruby.ViewRefParam.DefaultExtension" value="html.erb" />
- <property name="dynamic.classpath" value="false" />
- <property name="options.searchVisible" value="true" />
<property name="options.splitter.details.proportions" value="0.2" />
+ <property name="options.searchVisible" value="true" />
+ <property name="dynamic.classpath" value="false" />
+ <property name="Ruby.ViewRefParam.DefaultExtension" value="html.erb" />
+ <property name="GoToClass.includeJavaFiles" value="false" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
@@ -552,18 +540,6 @@
<option name="CONTEXT_PROVIDER" />
<method />
</configuration>
- <configuration default="false" name="Default" type="com.intellij.persistence.run.ConsoleRunConfigurationType" factoryName="Query Language Console" temporary="true">
- <option name="VM_PARAMETERS" value="" />
- <option name="USER_CFG_CLASS" />
- <option name="CONTEXT_PROVIDER" />
- <method />
- </configuration>
- <configuration default="false" name="Default" type="com.intellij.persistence.run.ConsoleRunConfigurationType" factoryName="Query Language Console" temporary="true">
- <option name="VM_PARAMETERS" value="" />
- <option name="USER_CFG_CLASS" />
- <option name="CONTEXT_PROVIDER" />
- <method />
- </configuration>
<configuration default="true" type="RakeRunConfigurationType" factoryName="Rake">
<module name="" />
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
@@ -691,7 +667,7 @@
</configuration>
<configuration default="true" type="JavascriptDebugSession" factoryName="Remote">
<JSRemoteDebuggerConfigurationSettings>
- <option name="engineId" />
+ <option name="engineId" value="embedded" />
<option name="fileUrl" />
</JSRemoteDebuggerConfigurationSettings>
<method>
@@ -802,14 +778,12 @@
<ConfigurationWrapper RunnerId="RubyRunner" />
<method />
</configuration>
- <list size="7">
- <item index="0" class="java.lang.String" itemvalue="Rake.test" />
- <item index="1" class="java.lang.String" itemvalue="Rake.spec" />
- <item index="2" class="java.lang.String" itemvalue="Rails.Production: cycle2work" />
- <item index="3" class="java.lang.String" itemvalue="Rails.Development: cycle2work" />
- <item index="4" class="java.lang.String" itemvalue="Query Language Console.Default" />
- <item index="5" class="java.lang.String" itemvalue="Query Language Console.Default" />
- <item index="6" class="java.lang.String" itemvalue="Query Language Console.Default" />
+ <list size="5">
+ <item index="0" class="java.lang.String" itemvalue="Query Language Console.Default" />
+ <item index="1" class="java.lang.String" itemvalue="Rake.test" />
+ <item index="2" class="java.lang.String" itemvalue="Rake.spec" />
+ <item index="3" class="java.lang.String" itemvalue="Rails.Production: cycle2work" />
+ <item index="4" class="java.lang.String" itemvalue="Rails.Development: cycle2work" />
</list>
</component>
<component name="ShelveChangesManager" show_recycled="false" />
@@ -833,38 +807,43 @@
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
+ <changelist id="b040972b-81a1-4da9-949e-6b0e7181157d" name="Default" comment="" />
<created>1335003041164</created>
<updated>1335003041164</updated>
</task>
<task id="LOCAL-00001" summary="Change readme">
<created>1335025453454</created>
<updated>1335025453454</updated>
</task>
- <option name="localTasksCounter" value="2" />
+ <task id="LOCAL-00002" summary="Add github address">
+ <created>1335025904771</created>
+ <updated>1335025904771</updated>
+ </task>
+ <option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="ToolWindowManager">
- <frame x="1365" y="0" width="1682" height="1055" extended-state="6" />
+ <frame x="-1" y="24" width="1368" height="725" extended-state="6" />
<editor active="false" />
<layout>
- <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
- <window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
- <window_info id="Changes" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32937366" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Data Sources" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+ <window_info id="Changes" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32885906" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
- <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.11764706" sideWeight="0.67062634" order="0" side_tool="false" content_ui="combo" />
- <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39956802" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
- <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
- <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
- <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4265659" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
- <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.1707132" sideWeight="0.67114097" order="0" side_tool="false" content_ui="combo" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.5604027" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+ <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
+ <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39765102" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
- <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
- <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
@@ -904,7 +883,7 @@
<option name="SHOW_VCS_ERROR_NOTIFICATIONS" value="true" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="false" />
- <option name="LAST_COMMIT_MESSAGE" value="Change readme" />
+ <option name="LAST_COMMIT_MESSAGE" value="Add github address" />
<option name="MAKE_NEW_CHANGELIST_ACTIVE" value="true" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_FILES_UP_TO_DATE_BEFORE_COMMIT" value="false" />
@@ -918,126 +897,111 @@
<option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
<option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
<MESSAGE value="Change readme" />
+ <MESSAGE value="Add github address" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="ruby-line">
- <url>file://$PROJECT_DIR$/app/controllers/welcome_controller.rb</url>
- <line>50</line>
+ <url>file://$PROJECT_DIR$/app/views/welcome/calculate.html.erb</url>
+ <line>1</line>
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
<component name="editorHistoryManager">
- <entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p0-perf@global/gems/geocoder-1.1.1/lib/geocoder/calculations.rb">
- <provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="-0.050816696">
- <folding />
- </state>
- </provider>
- </entry>
<entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p0-perf@global/gems/geocoder-1.1.1/lib/geocoder/cli.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p0-perf@global/gems/geocoder-1.1.1/lib/geocoder/configuration.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="2" column="50" selection-start="38" selection-end="38" vertical-scroll-proportion="0.003629764">
- <folding />
- </state>
+ <state line="2" column="50" selection-start="38" selection-end="38" vertical-scroll-proportion="0.003629764" />
</provider>
</entry>
<entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p0-perf@global/gems/geocoder-1.1.1/lib/geocoder/railtie.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p0-perf@global/gems/geocoder-1.1.1/lib/geocoder/request.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
- <folding />
- </state>
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Gemfile">
<provider selected="true" editor-type-id="text-editor">
- <state line="9" column="0" selection-start="165" selection-end="165" vertical-scroll-proportion="0.23316061">
- <folding />
- </state>
+ <state line="9" column="0" selection-start="165" selection-end="165" vertical-scroll-proportion="0.23316061" />
</provider>
</entry>
<entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p0-perf@global/gems/geocoder-1.1.1/lib/geocoder.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="-2.6010363">
- <folding />
- </state>
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="-2.6010363" />
</provider>
</entry>
<entry file="file://$USER_HOME$/.rvm/gems/ruby-1.9.3-p0-perf@global/gems/geocoder-1.1.1/lib/geocoder/lookups/google.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="22" column="21" selection-start="777" selection-end="777" vertical-scroll-proportion="0.5699482">
- <folding />
- </state>
+ <state line="22" column="21" selection-start="777" selection-end="777" vertical-scroll-proportion="0.5699482" />
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/assets/javascripts/index.js">
+ <entry file="file://$PROJECT_DIR$/app/views/welcome/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="108" column="0" selection-start="4155" selection-end="4155" vertical-scroll-proportion="0.0">
+ <state line="1" column="16" selection-start="34" selection-end="34" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/layouts/application.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="26" column="19" selection-start="1018" selection-end="1018" vertical-scroll-proportion="-16.25">
+ <state line="28" column="11" selection-start="1384" selection-end="1384" vertical-scroll-proportion="-13.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/lib/metoffice.rb">
+ <entry file="file://$PROJECT_DIR$/app/views/welcome/opensource.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="14" column="0" selection-start="549" selection-end="549" vertical-scroll-proportion="0.0">
+ <state line="0" column="58" selection-start="58" selection-end="58" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/welcome/index.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/views/welcome/privacy.html.erb">
<provider selected="true" editor-type-id="text-editor">
- <state line="1" column="16" selection-start="34" selection-end="34" vertical-scroll-proportion="-0.625">
+ <state line="0" column="96" selection-start="96" selection-end="96" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/welcome/calculate.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/assets/javascripts/index.js">
<provider selected="true" editor-type-id="text-editor">
- <state line="3" column="0" selection-start="244" selection-end="244" vertical-scroll-proportion="0.0">
+ <state line="107" column="0" selection-start="4017" selection-end="4017" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/helpers/welcome_helper.rb">
+ <entry file="file://$PROJECT_DIR$/lib/metoffice.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="24" column="40" selection-start="863" selection-end="863" vertical-scroll-proportion="0.0">
+ <state line="14" column="0" selection-start="549" selection-end="549" vertical-scroll-proportion="0.0" />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/app/views/welcome/calculate.html.erb">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="114" vertical-scroll-proportion="-0.0">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/welcome_controller.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="87" column="0" selection-start="3076" selection-end="3076" vertical-scroll-proportion="0.0">
+ <state line="26" column="100" selection-start="1194" selection-end="1194" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/app/views/welcome/opensource.html.erb">
+ <entry file="file://$PROJECT_DIR$/app/helpers/welcome_helper.rb">
<provider selected="true" editor-type-id="text-editor">
- <state line="0" column="16" selection-start="16" selection-end="16" vertical-scroll-proportion="0.0">
+ <state line="16" column="38" selection-start="634" selection-end="634" vertical-scroll-proportion="0.46197182">
<folding />
</state>
</provider>
View
1 app/assets/javascripts/index.js
@@ -105,7 +105,6 @@ function initialize() {
function loadScript() {
var script = document.createElement('script');
script.type = 'text/javascript';
-// script.src = 'http://maps.googleapis.com/maps/api/js?key=AIzaSyAUKt0lVU8KLfdJWtowMS1Ih1cMIin59SM&sensor=false&callback=initialize';
script.src = 'http://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize';
document.body.appendChild(script);
}
View
46 app/controllers/welcome_controller.rb
@@ -1,58 +1,46 @@
require 'metoffice'
-#require 'net/http'
-#require 'uri'
class WelcomeController < ApplicationController
DEFAULT_GEOG_MESSAGE = 'Postcode or address'
COMPASS_POINTS = %w[N NNE NE ENE E ESE SE SSE S SSW SW WSW W WNW NW NNW]
- TIMEOUT = 30
- API_KEY = '845d4be2-1112-4d73-b6a5-9624091a4bf7'
-
-# forecast site list = http://partner.metoffice.gov.uk/public/val/wxfcs/all/json/sitelist?key=845d4be2-1112-4d73-b6a5-9624091a4bf7
-# data for a site = http://partner.metoffice.gov.uk/public/val/wxfcs/all/json/3772?res=3hourly&key=845d4be2-1112-4d73-b6a5-9624091a4bf7
-
-# http://partner.metoffice.gov.uk/public/val/wxfcs/all/json/nearestlatlon?res=3hourly&lat=57.001&lon=56.672&key=<API key>
-
- def fetch_raw_data(url)
- timeout(TIMEOUT) do
- uri = URI.parse(url)
- client = Net::HTTP.new(uri.host, uri.port)
- response = client.get(uri.request_uri)
- response.body
- end
- end
-
- def get_forecasts_for_location(lat,lng)
- ActiveSupport::JSON.decode(fetch_raw_data("http://partner.metoffice.gov.uk/public/val/wxfcs/all/json/nearestlatlon?res=3hourly&lat=#{lat}&lon=#{lng}&key=#{API_KEY}"))
- end
+ DELTA = 0.00001
def index
- # Loads of stuff hard coded that shouldn't be
+ # Loads of stuff hard coded that shouldn't be - should be cookies eventually
@week_text = 'next week' # hard code for now
@warning = "Warning - weather forecasts are only available until #{(Time.now + 5.days).strftime('%A %I %p').gsub('0','')}. After that it is really guesswork (using the last data point)."
@mindays = 5
@maxdays = 5
@minhours = 5
@maxhours = 40
- @geog1 = 'TN22 4EA'
- @geog2 = 'TN39 5BF'
end
def calculate
+ lat1 = params[:lat1].to_f
+ lng1 = params[:lng1].to_f
+ lat1, lng1 = Geocoder.coordinates(params[:geog1]+', UK') if lat1 < DELTA.abs && lng1 < DELTA.abs
+ redirect_to :root_path, :alert => 'Cannot geocode ' + params[:geog1] if lat1 < DELTA.abs && lng1 < DELTA.abs
+ lat2 = params[:lat2].to_f
+ lng2 = params[:lng2].to_f
+ lat2, lng2 = Geocoder.coordinates(params[:geog2]+', UK') if lat2 < DELTA.abs && lng2 < DELTA.abs
+ redirect_to :root_path, :alert => 'Cannot geocode ' + params[:geog1] if lat2 < DELTA.abs && lng2 < DELTA.abs
+
# calculate direction (in both directions) and distance in miles
- @distance = Geocoder::Calculations.distance_between([params[:lat1].to_f,params[:lng1].to_f],[params[:lat2].to_f,params[:lng2].to_f],{:units => :mi})
- @bearing_in = Geocoder::Calculations.bearing_between([params[:lat1].to_f,params[:lng1].to_f],[params[:lat2].to_f,params[:lng2].to_f],{:units => :mi})
+ @distance = Geocoder::Calculations.distance_between([lat1, lng1], [lat2, lng2],{:units => :mi})
+ @bearing_in = Geocoder::Calculations.bearing_between([lat1, lng1], [lat2, lng2],{:units => :mi})
@bearing_home = (@bearing_in + 180) % 360
@direction = Geocoder::Calculations.compass_point(@bearing_in, COMPASS_POINTS)
# We should look for intermediate points as well
- start_point_data = MetOffice.get_forecasts_for_location(params[:lat1],params[:lng1])
- end_point_data = MetOffice.get_forecasts_for_location(params[:lat2],params[:lng2])
+ Rails.logger.info "#{lat1}, #{lng1}, #{lat2}, #{lng2}"
+ start_point_data = MetOffice.get_forecasts_for_location(lat1,lng1)
+ end_point_data = MetOffice.get_forecasts_for_location(lat2,lng2)
@sites = []
@sites << start_point_data["SiteRep"]["DV"]["Location"]
@sites << end_point_data["SiteRep"]["DV"]["Location"] if start_point_data["SiteRep"]["DV"]["Location"] != end_point_data["SiteRep"]["DV"]["Location"]
+ # just use the start point for now - need to get a bit more sophisticated later
# populate the days array with the next 5 days data
@days = []
View
10 app/helpers/welcome_helper.rb
@@ -7,20 +7,20 @@ def conditions(forecast, direction)
result = []
result << "Gusty" if (forecast["@G"].to_i > 20)
result << "Horrible" if forecast["@W"].to_i.between?(15,31)
-# result << forecast["@D"]
+ # ignore light winds
if forecast["@S"].to_i > 8
- # ignore light winds
seg_size = 360.0 / COMPASS_POINTS.length
wind_bearing = COMPASS_POINTS.index(forecast["@D"]) * seg_size
-# result << wind_bearing
helpful = (wind_bearing - direction).abs # 0 is in face 180 is behind
if helpful > 135
wind_effect = "Whoosh"
elsif helpful < 45
wind_effect = "Grind"
end
- wind_effect.upcase! if forecast["@S"].to_i > 15
- result << wind_effect
+ if wind_effect
+ wind_effect.upcase! if forecast["@S"].to_i > 15
+ result << wind_effect
+ end
end
result.join(' ')
else
View
12 app/views/layouts/application.html.erb
@@ -14,7 +14,19 @@
<%= csrf_meta_tags %>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="http://www.metoffice.gov.uk/favicon.ico" />
+ <script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-3037487-8']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+ </script>
</head>
<body>
View
2 app/views/welcome/opensource.html.erb
@@ -1 +1 @@
-You can get the <%= link_to 'source on the githubs','https://github.com/mchapman/lazy-cyclist' %>
+You can get the <%= link_to 'source on the githubs','http://github.com/mchapman/lazy-cyclist' %>
View
2 app/views/welcome/privacy.html.erb
@@ -1 +1 @@
-We won't record you data or your preferences. Uses cookies.
+We won't record your data or your preferences. Uses cookies (eventually - not for the hackday).

0 comments on commit 06ef607

Please sign in to comment.
Something went wrong with that request. Please try again.