Skip to content

Commit

Permalink
I had a dupe javascript_pack_tag
Browse files Browse the repository at this point in the history
  • Loading branch information
John Cwikla committed Aug 24, 2017
1 parent e77bd3a commit 93886f3
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 14 deletions.
3 changes: 2 additions & 1 deletion app/assets/javascripts/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

/*
Pyr.dashboard = {
pageSetup: function() {
//$('.pyr-page .page-default').showPage();
Expand All @@ -14,3 +14,4 @@ Pyr.addJob = {
$('.pyr-page .page-default').showPage();
},
};
*/
4 changes: 2 additions & 2 deletions app/javascript/packs/pages/candidates/candidates_page.jsx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ class CandidatesPage extends Page {
onSetUnaction={this.props.onSetUnaction}
onSelect={this.onSelect}
onUnselect={this.onUnselect}
getItems={this.getItems}
onGetItems={this.onGetItems}
/>
);
}
Expand All @@ -476,7 +476,7 @@ class CandidatesPage extends Page {
onSetUnaction={this.props.onSetUnaction}
onSelect={this.onSelect}
onUnselect={this.onUnselect}
getItems={this.getItems}
onGetItems={this.onGetItems}
/>
);
}
Expand Down
31 changes: 28 additions & 3 deletions app/javascript/packs/pages/messages/messages_page.jsx.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ import ReactDOM from 'react-dom';
import Pyr from '../../pyr/pyr';
const ClassNames = Pyr.ClassNames;
const Grid = Pyr.Grid;

import Page from '../page';
import Sheet from '../sheet';
import ThreadItem, { THREAD_ID } from './thread_item';

import {
UserAvatar
} from '../../util/user';

import ThreadItem, {
THREAD_ID
} from './thread_item';

import MessageThread, {
MessageThreadHeader,
Expand All @@ -29,6 +37,13 @@ function MID(message) {

class MessageItem extends Sheet.Item {

other(message) {
if (message.user.id == this.user().id) {
return message.from_user;
}
return message.user;
}

render() {
let message = this.props.message;
//console.log(JSON.stringify(message));
Expand All @@ -39,7 +54,7 @@ class MessageItem extends Sheet.Item {
let mine = message.mine;
let ownerClass = (mine ? "mine" : "yours");

let allClass = ClassNames("message-item", ownerClass);
let allClass = ClassNames("message-item flx-row", ownerClass);

if (!mine && !message.read_at) {
allClass.push("unread");
Expand All @@ -49,10 +64,19 @@ class MessageItem extends Sheet.Item {
allClass.push("new");
}

console.log(message);

let Header = message.candidate ? MessageThreadIndexHeader : MessageQAHeader;
let your = this.other(message);

return (
<div className={allClass} id={id}>
<Grid.Column className="col-1">
<UserAvatar
userId={your.id}
name={your.first_name}
/>
</Grid.Column>
<Grid.Column>
<Grid.Row className="">
<Grid.Column className="col-9">
Expand Down Expand Up @@ -245,7 +269,7 @@ class MessagesPage extends Page {
onSetUnaction={this.props.onSetUnaction}
onSelect={this.onSelect}
onUnselect={this.onUnselect}
getItems={this.onGetItems}
onGetItems={this.onGetItems}
/>
);
}
Expand All @@ -266,6 +290,7 @@ class MessagesPage extends Page {
onSetItem={this.onSetItem}
onSetAction={this.props.onSetAction}
onSetUnaction={this.props.onSetUnaction}
onGetItems={this.onGetItems}
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class RecruitersPage extends Page {
onSetUnaction={this.props.onSetUnaction}
onSelect={this.onSelect}
onUnselect={this.onUnselect}
getItems={this.getItems}
onGetItems={this.onGetItems}
/>
);
}
Expand Down
8 changes: 4 additions & 4 deletions app/javascript/packs/pages/sheet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Index extends Base {

componentDidMount() {
if (!this.props.items) {
this.props.getItems(this.onLoading);
this.props.onGetItems(this.onLoading);
}
}

Expand All @@ -157,9 +157,9 @@ class Index extends Base {
return items.sort((x, y) => y.id - x.id);
}

getItems(items) {
alert("Sheet:Index If you are seeing this, you need to implement getItems!");
}
//getItems(items) {
//alert("Sheet:Index If you are seeing this, you need to implement getItems!");
//}

renderChildren() {
let self = this;
Expand Down
6 changes: 4 additions & 2 deletions app/javascript/packs/util/user.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ const avatars = ["emilia", "snow", "sophie", "thetick"];

function getAvatar(uid) {
let pos = uid % avatars.length;
return "/assets/images/thrones/" + avatars[pos] + ".jpeg";
let av = "/assets/images/thrones/" + avatars[pos] + ".jpeg";
console.log(av);
return av;
}

const UserAvatar = (props) => (
<div className="flx-col user-avatar justify-content-center">
<div className="align-self-center"><img src={getAvatar(props.userId)}/></div>
<div className="align-self-center"><img src="/assets/images/thrones/thetick.jpeg"/></div>
{ props.name ? (<div className="align-self-center">{props.name}</div> ) : null }
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_container.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div id="react-container" class="h-100 w-100">
<%= yield %>
</div>
<%= javascript_pack_tag "pages/#{params[:controller]}" %>
<%#= javascript_pack_tag "pages/#{params[:controller]}" %>

<% else %>

Expand Down

0 comments on commit 93886f3

Please sign in to comment.