diff --git a/frontend/src/App.js b/frontend/src/App.js index 7ea55df..c37921a 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -5,12 +5,21 @@ import "./App.css"; import "./index.css"; import CacheBrowser from "./containers/CacheBrowser"; import CacheProfCont from "./containers/CacheProfCont"; + +import index from "./components/login/index" +import Login from "./components/login/Login" +import Signup from "./components/login/Signup" +import style from "./components/login/style.scss" +// import Login from "./Login"; +// import Login from './components/login/Login' + import MapContainer from "./containers/MapContainer"; import Navbar from "./Navbar"; import React, { Component } from "react"; -import Signup from './components/login/Signup'; +// import Signup from './components/login/Signup'; import UserContainer from "./containers/UserContainer"; import UserForm from './components/UserForm'; +import CacheNewForm from './components/CacheNewForm' class App extends React.Component { @@ -70,12 +79,27 @@ export default class App extends Component { }; render() { + + return ( + +
+ + {/* } handleCacheClick={this.handleCacheClick}/> */} + + + + + + +
{ @@ -97,6 +121,21 @@ export default class App extends Component { /> )} /> + + + { + return ( + + ); + }} + /> + + {/* */} + + @@ -105,6 +144,7 @@ export default class App extends Component { // currentUser={this.state.currentUser} /> } /> +
diff --git a/frontend/src/Navbar.js b/frontend/src/Navbar.js index b4b65f1..ee0a5be 100644 --- a/frontend/src/Navbar.js +++ b/frontend/src/Navbar.js @@ -49,6 +49,18 @@ class Navbar extends React.Component { background: 'royalblue' }} >Caches + + New Cache + + + + + + + + + + + + + + + + ) + } +} + diff --git a/frontend/src/components/login/index.js b/frontend/src/components/login/index.js index 45e030c..e7c2b82 100644 --- a/frontend/src/components/login/index.js +++ b/frontend/src/components/login/index.js @@ -1,4 +1,4 @@ -import "./style.scss"; +// import "./style.scss"; -export { Login } from "./login"; -export { Signup } from "./register"; \ No newline at end of file +// export { Login } from "./login"; +// export { Signup } from "./register"; \ No newline at end of file diff --git a/frontend/src/containers/CacheProfCont.js b/frontend/src/containers/CacheProfCont.js index b1632ac..92587ca 100644 --- a/frontend/src/containers/CacheProfCont.js +++ b/frontend/src/containers/CacheProfCont.js @@ -1,6 +1,7 @@ import React, { Component } from 'react'; -import CacheInfoContainer from './CacheInfoContainer' -import CacheReviewsContainer from './CacheReviewsContainer' +import CacheInfoContainer from './CacheInfoContainer'; +import CacheReviewsContainer from './CacheReviewsContainer'; +import CacheNewForm from '../components/CacheNewForm'; export default class CacheProfCont extends Component { diff --git a/geo-app-backend/app/models/cache.rb b/geo-app-backend/app/models/cache.rb index a006fac..668279e 100644 --- a/geo-app-backend/app/models/cache.rb +++ b/geo-app-backend/app/models/cache.rb @@ -14,9 +14,32 @@ def average_difficulty end def creator - histories.map do |history| + creator = "" + histories.each do |history| if history.created == true - history.user.username + creator = history.user.username + break + end + end + creator + end + + def reviewer + # reviewer = "" + # histories.map do |history| + # if history.id + # reviewer = history.user.username + # end + # reviewer + + # histories.user_id == histories.user.id + # return histories.user.username + + reviwer = "" + histories.map do |cache_history| + sought_user = User.find(cache_history.user_id) + if cache_history.user_id == sought_user.id + reviewer = [cache_history.id, sought_user.username] end end end diff --git a/geo-app-backend/app/models/history.rb b/geo-app-backend/app/models/history.rb index 9c8db89..6b3b29e 100644 --- a/geo-app-backend/app/models/history.rb +++ b/geo-app-backend/app/models/history.rb @@ -1,4 +1,12 @@ class History < ApplicationRecord belongs_to :user belongs_to :cache + + def reviewer + return 0 + # History.all.each do |history| + # reviewer = history.id + # end + end + end diff --git a/geo-app-backend/app/serializers/cache_serializer.rb b/geo-app-backend/app/serializers/cache_serializer.rb index e6055c2..8b7c2a5 100644 --- a/geo-app-backend/app/serializers/cache_serializer.rb +++ b/geo-app-backend/app/serializers/cache_serializer.rb @@ -1,3 +1,3 @@ class CacheSerializer < ActiveModel::Serializer - attributes :id, :name, :size, :average_difficulty, :average_rating, :creator, :description, :mystery, :hint, :warnings, :coordinates, :photo, :histories + attributes :id, :name, :size, :average_difficulty, :average_rating, :creator, :description, :mystery, :hint, :warnings, :coordinates, :photo, :reviewer, :histories, :users end diff --git a/geo-app-backend/app/serializers/history_serializer.rb b/geo-app-backend/app/serializers/history_serializer.rb index 1c68fce..8417e86 100644 --- a/geo-app-backend/app/serializers/history_serializer.rb +++ b/geo-app-backend/app/serializers/history_serializer.rb @@ -1,5 +1,5 @@ class HistorySerializer < ActiveModel::Serializer - attributes :id, :created, :favorite, :to_do, :done, :difficulty, :rating, :comment + attributes :id, :created, :favorite, :to_do, :done, :difficulty, :rating, :comment, :reviewer, has_one :user has_one :cache end