-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
151 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class MarketVendorsController < ApplicationController | ||
def index | ||
if params[:market_id] | ||
@market_vendors = MarketVendor.where(market_id: params[:market_id]) | ||
render json: @market_vendors, each_serializer: MarketVendorOnlyVendorSerializer, root: false | ||
else | ||
@market_vendors = MarketVendor.where(vendor_id: params[:vendor_id]) if params[:vendor_id] | ||
render json: @market_vendors, each_serializer: MarketVendorSerializer, root: false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class MarketVendorOnlyVendorSerializer < ActiveModel::Serializer | ||
attributes :id, | ||
:booth_location, :vendor | ||
|
||
def vendor | ||
return VendorSerializer.new(object.vendor, root: false) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class MarketVendorSerializer < ActiveModel::Serializer | ||
attributes :id, | ||
:booth_location, :market, :vendor | ||
|
||
def market | ||
return MarketSerializer.new(object.market, root: false) | ||
end | ||
|
||
def vendor | ||
return VendorSerializer.new(object.vendor, root: false) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
db/migrate/20160915054510_add_booth_info_to_market_vendors.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class AddBoothInfoToMarketVendors < ActiveRecord::Migration | ||
def change | ||
add_column :market_vendors, :booth_location, :string | ||
add_column :market_vendors, :at_market_longitude, :float | ||
add_column :market_vendors, :at_market_latitude, :float | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
frontend/app/modules/market-vendors/market-vendors-list.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<div data-ng-show="vm.marketVendors.length"> | ||
<table> | ||
<thead> | ||
<th>Booth</th> | ||
<th>Vendor</th> | ||
<th>Products</th> | ||
</thead> | ||
<tbody> | ||
<tr data-ng-repeat="marketVendor in vm.marketVendors | orderBy: 'vendor.name' track by marketVendor.id"> | ||
<td><span data-ng-bind="marketVendor.booth_location"></span></td> | ||
<td><span data-ng-bind="marketVendor.vendor.name"></span></td> | ||
<td><span data-ng-bind="marketVendor.vendor.description"></span></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> |
32 changes: 32 additions & 0 deletions
32
frontend/app/modules/market-vendors/market-vendors-list.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(function() { | ||
'use strict'; | ||
angular | ||
.module('ttfm.market-vendors') | ||
.directive('marketVendorsList', Directive); | ||
function Directive() { | ||
function Controller(MarketVendorsService) { | ||
var vm = this; | ||
function initialize() { | ||
MarketVendorsService.query({market_id: vm.market.id}).then(function(marketVendors) { | ||
vm.marketVendors = marketVendors; | ||
console.info("WHAT"); | ||
}); | ||
console.info("WHAT"); | ||
|
||
} | ||
initialize(); | ||
} | ||
|
||
return { | ||
restrict: 'A', | ||
templateUrl: 'market-vendors-list.html', | ||
replace: true, | ||
controller: ['MarketVendorsService', Controller], | ||
controllerAs: 'vm', | ||
bindToController: true, | ||
scope: { | ||
market: '=' | ||
} | ||
}; | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(function() { | ||
angular | ||
.module('ttfm.market-vendors', []) | ||
.config(['$stateProvider', Routes]); | ||
|
||
function Routes($stateProvider) { | ||
} | ||
})(); |
10 changes: 10 additions & 0 deletions
10
frontend/app/modules/market-vendors/market-vendors-service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(function() { | ||
angular | ||
.module('ttfm.market-vendors') | ||
.service('MarketVendorsService', ['$rootScope', '$sanitize', 'BaseServiceFactory', Service]); | ||
|
||
function Service($rootScope, $sanitize, BaseServiceFactory) { | ||
var service = BaseServiceFactory('market_vendor', 'market_vendors'); | ||
return service; | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters