Skip to content

Commit d243cb6

Browse files
Hiroshi HondaHiroshi Honda
authored andcommitted
angle-reactjs-seed
0 parents  commit d243cb6

File tree

181 files changed

+17419
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+17419
-0
lines changed

app/.DS_Store

6 KB
Binary file not shown.

app/App.jsx

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*!
2+
*
3+
* Angle - Bootstrap Admin App + ReactJS
4+
*
5+
* Version: 3.7
6+
* Author: @themicon_co
7+
* Website: http://themicon.co
8+
* License: https://wrapbootstrap.com/help/licenses
9+
*
10+
*/
11+
12+
import React from 'react';
13+
import ReactDOM from 'react-dom';
14+
import { Router, Route, Link, hashHistory, useRouterHistory, IndexRoute } from 'react-router';
15+
import { createHistory } from 'history';
16+
17+
import initTranslation from './components/Common/localize';
18+
import initLoadThemes from './components/Common/load-themes';
19+
20+
import Base from './components/Layout/Base';
21+
import BasePage from './components/Layout/BasePage';
22+
import BaseHorizontal from './components/Layout/BaseHorizontal';
23+
24+
import SingleView from './components/SingleView/SingleView';
25+
import SubMenu from './components/SubMenu/SubMenu';
26+
27+
// Application Styles
28+
import './styles/bootstrap.scss';
29+
import './styles/app.scss'
30+
31+
32+
// Init translation system
33+
initTranslation();
34+
// Init css loader (for themes)
35+
initLoadThemes();
36+
37+
// Disable warning "Synchronous XMLHttpRequest on the main thread is deprecated.."
38+
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
39+
options.async = true;
40+
});
41+
42+
// specify basename below if running in a subdirectory or set as "/" if app runs in root
43+
const appHistory = useRouterHistory(createHistory)({
44+
basename: WP_BASE_HREF
45+
})
46+
47+
ReactDOM.render(
48+
<Router history={appHistory}>
49+
<Route path="/" component={Base}>
50+
51+
{/* Default route*/}
52+
<IndexRoute component={SingleView} />
53+
54+
<Route path="singleview" component={SingleView}/>
55+
<Route path="submenu" component={SubMenu}/>
56+
57+
</Route>
58+
59+
{/* Not found handler */}
60+
{/*<Route path="*" component={NotFound}/>*/}
61+
62+
</Router>,
63+
document.getElementById('app')
64+
);
65+
66+
// Auto close sidebar on route changes
67+
appHistory.listen(function(ev) {
68+
$('body').removeClass('aside-toggled');
69+
});

app/Vendor.jsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Modernizr
2+
import '../bower_components/modernizr/modernizr.custom.js';
3+
// jQuery
4+
import '../bower_components/jquery/dist/jquery.js';
5+
// jQuery-Storage-API
6+
import '../bower_components/jQuery-Storage-API/jquery.storageapi.js';
7+
// jquery.easing
8+
import '../bower_components/jquery.easing/js/jquery.easing.js';
9+
// Whirl
10+
import '../bower_components/whirl/dist/whirl.css';
11+
// Animo
12+
import '../bower_components/animo.js/animo.js';
13+
// Font Awesome
14+
import '../bower_components/fontawesome/css/font-awesome.min.css';
15+
// Animate.CSS
16+
import '../bower_components/animate.css/animate.min.css';
17+
// Simple line icons
18+
import '../bower_components/simple-line-icons/css/simple-line-icons.css';
19+
// Localization
20+
import '../bower_components/jquery-localize-i18n/dist/jquery.localize.js';

app/components/Common/constants.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// GLOBAL CONSTANTS
2+
// -----------------------------------
3+
4+
export const APP_COLORS = {
5+
'primary': '#5d9cec',
6+
'success': '#27c24c',
7+
'info': '#23b7e5',
8+
'warning': '#ff902b',
9+
'danger': '#f05050',
10+
'inverse': '#131e26',
11+
'green': '#37bc9b',
12+
'pink': '#f532e5',
13+
'purple': '#7266ba',
14+
'dark': '#3a3f51',
15+
'yellow': '#fad732',
16+
'gray-darker': '#232735',
17+
'gray-dark': '#3a3f51',
18+
'gray': '#dde6e9',
19+
'gray-light': '#e4eaec',
20+
'gray-lighter': '#edf1f2'
21+
};
22+
23+
export const APP_MEDIAQUERY = {
24+
'desktopLG': 1200,
25+
'desktop': 992,
26+
'tablet': 768,
27+
'mobile': 480
28+
};

app/components/Common/fullscreen.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// FULLSCREEN
2+
// -----------------------------------
3+
4+
function initScreenfull() {
5+
6+
if (typeof screenfull === 'undefined') return;
7+
8+
var $doc = $(document);
9+
var $fsToggler = $(this);
10+
11+
// Not supported under IE
12+
var ua = window.navigator.userAgent;
13+
if (ua.indexOf("MSIE ") > 0 || !!ua.match(/Trident.*rv\:11\./)) {
14+
$fsToggler.addClass('hide');
15+
}
16+
17+
if (!$fsToggler.is(':visible')) // hidden on mobiles or IE
18+
return;
19+
20+
$fsToggler.on('click', function(e) {
21+
e.preventDefault();
22+
23+
if (screenfull.enabled) {
24+
25+
screenfull.toggle();
26+
27+
// Switch icon indicator
28+
toggleFSIcon($fsToggler);
29+
30+
} else {
31+
console.log('Fullscreen not enabled');
32+
}
33+
});
34+
35+
if (screenfull.raw && screenfull.raw.fullscreenchange)
36+
$doc.on(screenfull.raw.fullscreenchange, function() {
37+
toggleFSIcon($fsToggler);
38+
});
39+
40+
function toggleFSIcon($element) {
41+
if (screenfull.isFullscreen)
42+
$element.children('em').removeClass('fa-expand').addClass('fa-compress');
43+
else
44+
$element.children('em').removeClass('fa-compress').addClass('fa-expand');
45+
}
46+
47+
}
48+
49+
export default () => {
50+
51+
$('[data-toggle-fullscreen]').each(initScreenfull);
52+
53+
}

app/components/Common/load-themes.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// LOAD THEMES
2+
// -----------------------------------
3+
4+
const themeA = require('!raw!sass!../../styles/themes/theme-a.scss');
5+
const themeB = require('!raw!sass!../../styles/themes/theme-b.scss');
6+
const themeC = require('!raw!sass!../../styles/themes/theme-c.scss');
7+
const themeD = require('!raw!sass!../../styles/themes/theme-d.scss');
8+
const themeE = require('!raw!sass!../../styles/themes/theme-e.scss');
9+
const themeF = require('!raw!sass!../../styles/themes/theme-f.scss');
10+
const themeG = require('!raw!sass!../../styles/themes/theme-g.scss');
11+
const themeH = require('!raw!sass!../../styles/themes/theme-h.scss');
12+
13+
export default () => {
14+
15+
let styleTag;
16+
let defaultTheme = 'A';
17+
18+
$(document).on('click', '[data-load-theme]', function(e) {
19+
createStyle();
20+
setTheme($(this).data('loadTheme'));
21+
});
22+
23+
function setTheme(name) {
24+
switch (name) {
25+
case 'A':
26+
injectStylesheet(themeA);
27+
break;
28+
case 'B':
29+
injectStylesheet(themeB);
30+
break;
31+
case 'C':
32+
injectStylesheet(themeC);
33+
break;
34+
case 'D':
35+
injectStylesheet(themeD);
36+
break;
37+
case 'E':
38+
injectStylesheet(themeE);
39+
break;
40+
case 'F':
41+
injectStylesheet(themeF);
42+
break;
43+
case 'G':
44+
injectStylesheet(themeG);
45+
break;
46+
case 'H':
47+
injectStylesheet(themeH);
48+
break;
49+
}
50+
}
51+
52+
function createStyle() {
53+
// remove if exists
54+
var el = document.getElementById('appthemes');
55+
if (el) el.parentNode.removeChild(el);
56+
// create
57+
const head = document.head || document.getElementsByTagName('head')[0];
58+
styleTag = document.createElement('style');
59+
styleTag.type = 'text/css';
60+
styleTag.id = 'appthemes';
61+
head.appendChild(styleTag);
62+
}
63+
64+
function injectStylesheet(css) {
65+
styleTag.innerHTML = css;
66+
}
67+
68+
}

app/components/Common/localize.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// TRANSLATION
2+
// -----------------------------------
3+
4+
const preferredLang = 'en';
5+
const pathPrefix = 'server/i18n'; // folder of json files
6+
const packName = 'site';
7+
const storageKey = 'jq-appLang';
8+
9+
export default () => {
10+
11+
if (!$.fn.localize) return;
12+
13+
// detect saved language or use default
14+
var currLang = $.localStorage.get(storageKey) || preferredLang;
15+
// set initial options
16+
var opts = {
17+
language: currLang,
18+
pathPrefix: pathPrefix,
19+
callback: function(data, defaultCallback) {
20+
$.localStorage.set(storageKey, currLang); // save the language
21+
defaultCallback(data);
22+
}
23+
};
24+
25+
// Set initial language
26+
setLanguage(opts);
27+
28+
// Listen for changes
29+
$(document).on('click', '[data-set-lang]', function() {
30+
31+
currLang = $(this).data('setLang');
32+
33+
if (currLang) {
34+
35+
opts.language = currLang;
36+
37+
setLanguage(opts);
38+
39+
activateDropdown($(this));
40+
}
41+
42+
});
43+
44+
45+
function setLanguage(options) {
46+
$("[data-localize]").localize(packName, options);
47+
}
48+
49+
// Set the current clicked text as the active dropdown text
50+
function activateDropdown(elem) {
51+
var menu = elem.parents('.dropdown-menu');
52+
if (menu.length) {
53+
var toggle = menu.prev('button, a');
54+
toggle.text(elem.text());
55+
}
56+
}
57+
58+
}

app/components/Common/maps-google.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Google Maps
2+
// -----------------------------------
3+
4+
export default function() {
5+
6+
if (!$.fn.gMap) return;
7+
8+
// Custom core styles
9+
// Get more styles from http://snazzymaps.com/style/29/light-monochrome
10+
// - Just replace and assign to 'MapStyles' the new style array
11+
var MapStyles = [{featureType:'water',stylers:[{visibility:'on'},{color:'#bdd1f9'}]},{featureType:'all',elementType:'labels.text.fill',stylers:[{color:'#334165'}]},{featureType:'landscape',stylers:[{color:'#e9ebf1'}]},{featureType:'road.highway',elementType:'geometry',stylers:[{color:'#c5c6c6'}]},{featureType:'road.arterial',elementType:'geometry',stylers:[{color:'#fff'}]},{featureType:'road.local',elementType:'geometry',stylers:[{color:'#fff'}]},{featureType:'transit',elementType:'geometry',stylers:[{color:'#d8dbe0'}]},{featureType:'poi',elementType:'geometry',stylers:[{color:'#cfd5e0'}]},{featureType:'administrative',stylers:[{visibility:'on'},{lightness:33}]},{featureType:'poi.park',elementType:'labels',stylers:[{visibility:'on'},{lightness:20}]},{featureType:'road',stylers:[{color:'#d8dbe0',lightness:20}]}];
12+
13+
var gMapRefs = [];
14+
15+
var $this = $(this),
16+
addresses = $this.data('address') && $this.data('address').split(
17+
';'),
18+
titles = $this.data('title') && $this.data('title').split(';'),
19+
zoom = $this.data('zoom') || 14,
20+
maptype = $this.data('maptype') || 'ROADMAP', // or 'TERRAIN'
21+
markers = [];
22+
23+
if (addresses) {
24+
for (var a in addresses) {
25+
if (typeof addresses[a] == 'string') {
26+
markers.push({
27+
address: addresses[a],
28+
html: (titles && titles[a]) || '',
29+
popup: true /* Always popup */
30+
});
31+
}
32+
}
33+
34+
var options = {
35+
controls: {
36+
panControl: true,
37+
zoomControl: true,
38+
mapTypeControl: true,
39+
scaleControl: true,
40+
streetViewControl: true,
41+
overviewMapControl: true
42+
},
43+
scrollwheel: false,
44+
maptype: maptype,
45+
markers: markers,
46+
zoom: zoom
47+
// More options https://github.com/marioestrada/jQuery-gMap
48+
};
49+
50+
var gMap = $this.gMap(options);
51+
52+
var ref = gMap.data('gMap.reference');
53+
// save in the map references list
54+
gMapRefs.push(ref);
55+
56+
// set the styles
57+
if ($this.data('styled') !== undefined) {
58+
59+
ref.setOptions({
60+
styles: MapStyles
61+
});
62+
63+
}
64+
}
65+
66+
} //initGmap

0 commit comments

Comments
 (0)