Skip to content
Permalink
Browse files

Use materialize css in webpacker

  • Loading branch information...
bingxie committed Apr 17, 2019
1 parent 047eed8 commit b58632eb40ec2fe9e42976f5cb48f8a8e0f5987f
@@ -1,9 +1 @@
@import "normalize-rails";

@import "welcome";
@import "login";

.alert {
color: red;
font-weight: bold;
}
// @import "normalize-rails";

This file was deleted.

Oops, something went wrong.
@@ -7,5 +7,11 @@
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
// layout file, like app/views/layouts/application.html.erb

console.log(`Hello World ${1 + 2} from Webpacker`);
console.log("Version 9");
import "materialize-css/dist/js/materialize";

import "../stylesheets/application";

document.addEventListener("DOMContentLoaded", function() {
const elems = document.querySelectorAll(".sidenav");
let instances = M.Sidenav.init(elems);
});
@@ -1,3 +1,5 @@
@import "materialize-css/dist/css/materialize";

.wrapper {
max-width: 78.75em;
margin-left: auto;
@@ -8,3 +10,8 @@
.login {
width: 30em;
}

.alert {
color: red;
font-weight: bold;
}
@@ -1,35 +1,71 @@
<!DOCTYPE html>
<html>
<head>
<title>InvestmentRadar</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
<title>Investment-Radar</title>
<%= csrf_meta_tags %>

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application' %>
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'hello_react' %>
</head>

<body>
<section class="container">
<div class="wrapper">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th><h2><%= link_to "投资雷达", root_path %></h2></th>
<th><h2><%= link_to "持仓列表", positions_path %></h2></th>
<th><h2><%= link_to "盈亏报告", trading_records_path %></h2></th>
<th><h2><%= link_to "图表分析", page_path("charts") %></h2></th>
<th><h2><%= link_to "后台管理", admin_root_path %></h2></th>
</tr>
</tbody>
</table>

<nav class="light-blue lighten-1" role="navigation">
<div class="nav-wrapper container"><a id="logo-container" href="#" class="brand-logo">投资雷达</a>
<ul class="right hide-on-med-and-down">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "持仓列表", positions_path %></li>
<li><%= link_to "盈亏报告", trading_records_path %></li>
<li><%= link_to "图表分析", page_path("charts") %></li>
<li><%= link_to "后台管理", admin_root_path %></li>
</ul>
<ul id="nav-mobile" class="sidenav">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "持仓列表", positions_path %></li>
<li><%= link_to "盈亏报告", trading_records_path %></li>
<li><%= link_to "图表分析", page_path("charts") %></li>
<li><%= link_to "后台管理", admin_root_path %></li>
</ul>
<a href="#" data-target="nav-mobile" class="sidenav-trigger"><i class="material-icons">menu</i></a>
</div>
</nav>
<div class="container">
<div class="section">
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>

<%= yield %>
<div>
</section>
</div>
</div>
<footer class="page-footer orange">
<div class="container">
<div class="row">
<div class="col l6 s12">
<h5 class="white-text">投资雷达</h5>
<p class="grey-text text-lighten-4">一个美股投资的资金管理和交易分析的平台</p>
</div>
<div class="col l3 s12">
<h5 class="white-text">关于项目</h5>
<ul>
<li><a class="white-text" href="https://github.com/bingxie/investment-radar">Github</a></li>
</ul>
</div>
<div class="col l3 s12">
<h5 class="white-text">数据来源</h5>
<ul>
<li><a class="white-text" href="https://iexcloud.io/">IEX Cloud</a></li>
<li><a class="white-text" href="https://au.finance.yahoo.com/">Yahoo Finance</a></li>
<li><a class="white-text" href="https://www.alphavantage.co/">Alpha Vantage</a></li>
</ul>
</div>
</div>
</div>
<div class="footer-copyright">
<div class="container">
Made by <a class="orange-text text-lighten-3" href="https://github.com/bingxie">BingXie</a>
</div>
</div>
</footer>
</body>
</html>
@@ -1,11 +1,9 @@
<h2>
My Positions - [简单-Simplicity 一致-Consistency 纪律-Discipline]
</h2>

<h5 class="center">
My Positions - [简单-Simplicity 一致-Consistency 纪律-Discipline]
</h5>
<% if @long_term_stocks.size > 5 %>
<p class="alert">不要持有超过 5 只股票</p>
<% end %>

<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
@@ -50,23 +48,21 @@ My Positions - [简单-Simplicity 一致-Consistency 纪律-Discipline]
<% end %>
</tbody>
</table>

<b>Total Market:</b> <%= @total_market_value %> |
Total Cost: <%= @total_cost %> |
<b>Gain/Lost:</b> <%= @total_gain %> |
Total Capital: <%= LongTermStock::TOTAL_CAPITAL %> |
<b>Cash:</b> <%= @cash %> |
<b>Total Risk</b>: <%= @total_risk%> --- <%= @total_risk_percentage %>% <span class='alert'>(<=6%)</span>

<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<%= pie_chart(@cost_chart_data, width: "400px") %>
</td>
<td>
<%= pie_chart(@market_chart_data, width: "400px") %>
</td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<%= pie_chart(@cost_chart_data, width: "400px") %>
</td>
<td>
<%= pie_chart(@market_chart_data, width: "400px") %>
</td>
</tr>
</tbody>
</table>
@@ -1,24 +1,20 @@
<h2>
盈亏报告
</h2>

<h2>Total Profit: <%= @total_profit %> </h2>

<h5 class="center">
盈亏报告
</h5>
<h6>Total Profit: <%= @total_profit %> </h6>
<% chart_data = {"2019-01" => 2402.2, '2019-02' => 12402.2, '2019-03' => 22402.2}%>

<%= column_chart chart_data %>

<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th>Stock</th>
<th>Profit</th>
<tr>
<% @sorted_records.each do |record| %>
<tr>
<td><%= record[0] %></td>
<td><%= record[1].round(2) %></td>
</tr>
<% end %>
</tbody>
</table>
<% @sorted_records.each do |record| %>
<tr>
<td><%= record[0] %></td>
<td><%= record[1].round(2) %></td>
</tr>
<% end %>
</tbody>
</table>
@@ -1,10 +1,10 @@
<% if user_signed_in? %>
<li>
<%= link_to("Logout #{current_user.email}", destroy_user_session_path, method: :delete) %>
<%= link_to("Logout #{current_user.email}", destroy_user_session_path, method: :delete) %>
</li>
<% else %>
<li>
<%= link_to('Login', new_user_session_path) %>
<%= link_to('Login', new_user_session_path) %>
</li>
<% end %>
<hr />
@@ -18,12 +18,11 @@
</ul>
</div>
<hr />
<h2>Market News</h2>
<h5>Market News</h5>
<% @market_news.each do |news| %>
<p><%= news["datetime"].strftime('%Y-%m-%d %I:%M%p') %> | <%= news["source"] %> |<a href="<%= news["url"] %>"><%= news["headline"] %></a></p>
<% end %>

<h2>Stocks News</h2>
<h5>Stocks News</h5>
<% @stocks_news.each do |news| %>
<p><%= news["datetime"].strftime('%Y-%m-%d %I:%M%p') %> | <%= news["source"] %> |<a href="<%= news["url"] %>"><%= news["headline"] %></a></p>
<% end %>
@@ -8,6 +8,7 @@
"coffeescript": "1.12.7",
"core-js": "3",
"highcharts": "^7.0.3",
"materialize-css": "^1.0.0",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
@@ -3925,6 +3925,11 @@ map-visit@^1.0.0:
dependencies:
object-visit "^1.0.0"

materialize-css@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/materialize-css/-/materialize-css-1.0.0.tgz#8d5db1c4a81c6d65f3b2e2ca83a8e08daa24d1be"
integrity sha512-4/oecXl8y/1i8RDZvyvwAICyqwNoKU4or5uf8uoAd74k76KzZ0Llym4zhJ5lLNUskcqjO0AuMcvNyDkpz8Z6zw==

md5.js@^1.3.4:
version "1.3.5"
resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f"

0 comments on commit b58632e

Please sign in to comment.
You can’t perform that action at this time.