mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-28 01:53:25 +00:00
Adding darkswarm variant of home page, getting Angular skeleton into place, taking shit off window
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
#= require ../shared/bindonce.min.js
|
||||
#= require ../shared/ng-infinite-scroll.min.js
|
||||
#= require ../shared/angular-local-storage.js
|
||||
#= require ../search/jquery.backstretch.js
|
||||
#= require angular-backstretch.js
|
||||
#= require angular-flash.min.js
|
||||
#
|
||||
#= require ../shared/jquery.timeago
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.AccountSidebarCtrl = Darkswarm.controller "AccountSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
Darkswarm.controller "AccountSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
$scope.path = "/account"
|
||||
Navigation.paths.push $scope.path
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.AuthenticationActionsCtrl = Darkswarm.controller "AuthenticationActionsCtrl", ($scope, Navigation, storage) ->
|
||||
Darkswarm.controller "AuthenticationActionsCtrl", ($scope, Navigation, storage) ->
|
||||
$scope.toggleLogin = ->
|
||||
Navigation.navigate "/login"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.ForgotSidebarCtrl = Darkswarm.controller "ForgotSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
Darkswarm.controller "ForgotSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
$scope.spree_user = SpreeUser.spree_user
|
||||
$scope.path = "/forgot"
|
||||
$scope.sent = false
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
Darkswarm.controller "HubsCtrl", ($scope, Hubs) ->
|
||||
console.log Hubs.hubs[0]
|
||||
$scope.Hubs = Hubs
|
||||
$scope.hubs = Hubs.hubs
|
||||
@@ -1,4 +1,4 @@
|
||||
window.LoginSidebarCtrl = Darkswarm.controller "LoginSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
Darkswarm.controller "LoginSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
$scope.spree_user = SpreeUser.spree_user
|
||||
$scope.path = "/login"
|
||||
Navigation.paths.push $scope.path
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.SidebarCtrl = Darkswarm.controller "SidebarCtrl", ($scope, $location) ->
|
||||
Darkswarm.controller "SidebarCtrl", ($scope, $location) ->
|
||||
$scope.sidebarPaths = ["/login", "/signup", "/forgot", "/account"]
|
||||
|
||||
$scope.active = ->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.SignupSidebarCtrl = Darkswarm.controller "SignupSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
Darkswarm.controller "SignupSidebarCtrl", ($scope, $http, $location, SpreeUser, Navigation) ->
|
||||
$scope.spree_user = SpreeUser.spree_user
|
||||
$scope.path = "/signup"
|
||||
Navigation.paths.push $scope.path
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
window.Darkswarm = angular.module("Darkswarm", ["ngResource", "filters", 'mm.foundation', 'angularLocalStorage', 'pasvaz.bindonce', 'infinite-scroll', 'angular-flash.service']).config ($httpProvider, $tooltipProvider) ->
|
||||
window.Darkswarm = angular.module("Darkswarm", ["ngResource", "filters", 'mm.foundation', 'angularLocalStorage', 'pasvaz.bindonce', 'infinite-scroll', 'angular-flash.service', 'backstretch']).config ($httpProvider, $tooltipProvider) ->
|
||||
$httpProvider.defaults.headers.post['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
|
||||
$httpProvider.defaults.headers.put['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
|
||||
$httpProvider.defaults.headers['common']['X-Requested-With'] = 'XMLHttpRequest'
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Darkswarm.directive "ofnDisableEnter", ()->
|
||||
restrict: 'A'
|
||||
link: (scope, element, attrs)->
|
||||
element.bind "keydown keypress", (e)->
|
||||
code = e.keyCode || e.which
|
||||
if code == 13
|
||||
e.preventDefault()
|
||||
|
||||
|
||||
4
app/assets/javascripts/darkswarm/services/hubs.js.coffee
Normal file
4
app/assets/javascripts/darkswarm/services/hubs.js.coffee
Normal file
@@ -0,0 +1,4 @@
|
||||
Darkswarm.factory 'Hubs', ($location, hubs) ->
|
||||
new class Hubs
|
||||
constructor: ->
|
||||
@hubs = hubs
|
||||
@@ -1,5 +1,6 @@
|
||||
class DarkswarmController < ApplicationController
|
||||
def index
|
||||
class DarkswarmController < BaseController
|
||||
layout 'darkswarm'
|
||||
|
||||
def index
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1 +1,34 @@
|
||||
TESTING
|
||||
%div#image-url-container{backstretch: true,
|
||||
"background-url" => "#{LandingPageImage.random.photo.url(:max_common_res)}" }
|
||||
.row
|
||||
.large-10.large-centered.columns
|
||||
#postcode_select_box
|
||||
.row
|
||||
.large-12.columns
|
||||
#logo-container= image_tag "ofn_logo.png"
|
||||
.row
|
||||
.large-12.large-centered.columns
|
||||
= link_to about_us_path do
|
||||
%strong
|
||||
%i What is open food network?
|
||||
|
||||
.row
|
||||
.large-12.columns.text-center
|
||||
%h2 Ready to shop?
|
||||
%p Select a food hub from the list below:
|
||||
#hubs{"ng-controller" => "HubsCtrl"}
|
||||
|
||||
:javascript
|
||||
angular.module('Darkswarm').value('hubs', #{render "shared/hubs"})
|
||||
|
||||
.row
|
||||
.large-9.columns
|
||||
%input{type: :text, "ng-model" => "query", value: "Search postcode, suburb or hub name...",
|
||||
"ofn-disable-enter" => true}
|
||||
.large-3.columns
|
||||
Advanced search
|
||||
.row
|
||||
.large-12.columns
|
||||
%ul
|
||||
%li{"ng-repeat" => "hub in hubs | filter:query"}
|
||||
%pre {{ hub | json }}
|
||||
|
||||
@@ -37,13 +37,16 @@
|
||||
%li= link_to "Distributors", "#", :data => { "reveal-id" => "become-distributor" }
|
||||
%li.divider
|
||||
%li= link_to "Farmers", "#", :data => { "reveal-id" => "become-farmer" }
|
||||
|
||||
%section{ role: "main" }
|
||||
= yield
|
||||
|
||||
%section#sidebar{ role: "complementary" }
|
||||
.login-panel
|
||||
#login-content.hide
|
||||
= render "home/login"
|
||||
#sign-up-content.hide
|
||||
= render "home/signup"
|
||||
|
||||
= yield :scripts
|
||||
|
||||
|
||||
30
app/views/shared/_hubs.rabl
Normal file
30
app/views/shared/_hubs.rabl
Normal file
@@ -0,0 +1,30 @@
|
||||
collection Enterprise.is_distributor
|
||||
attributes :name, :id
|
||||
|
||||
child :address do
|
||||
attributes :city
|
||||
node :state do |address|
|
||||
address.state.abbr
|
||||
end
|
||||
end
|
||||
|
||||
node :pickup do |hub|
|
||||
not hub.shipping_methods.where(:require_ship_address => false).empty?
|
||||
end
|
||||
|
||||
node :delivery do |hub|
|
||||
not hub.shipping_methods.where(:require_ship_address => true).empty?
|
||||
end
|
||||
|
||||
node :path do |hub|
|
||||
shop_enterprise_path(hub)
|
||||
end
|
||||
|
||||
#child :shipping_methods do
|
||||
#attributes :name, :require_ship_address
|
||||
#end
|
||||
|
||||
# ALL PRODUCERS
|
||||
#
|
||||
# Orders closing when?
|
||||
# Current order_cycle + closing when?
|
||||
@@ -6,8 +6,6 @@
|
||||
%input#search.text{"ng-model" => "query", placeholder: "Search", "ng-keypress" => "searchKeypress($event)"}
|
||||
%input.button.right{type: :submit, value: "Add to Cart"}
|
||||
|
||||
{{ limit }}
|
||||
|
||||
%table
|
||||
%thead
|
||||
%th.name Item
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Openfoodnetwork::Application.routes.draw do
|
||||
root :to => 'home#temp_landing_page'
|
||||
root :to => 'darkswarm#index'
|
||||
|
||||
resource :shop, controller: "shop/shop" do
|
||||
get :products
|
||||
|
||||
10
vendor/assets/javascripts/angular-backstretch.js
vendored
Normal file
10
vendor/assets/javascripts/angular-backstretch.js
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
angular.module('backstretch', []);
|
||||
angular.module('backstretch')
|
||||
.directive('backstretch', function () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attr) {
|
||||
element.backstretch(attr.backgroundUrl);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user