diff --git a/js/actions/license_actions.js b/js/actions/license_actions.js new file mode 100644 index 00000000..358c158a --- /dev/null +++ b/js/actions/license_actions.js @@ -0,0 +1,25 @@ +'use strict'; + +import alt from '../alt'; +import LicenseFetcher from '../fetchers/license_fetcher'; + + +class LicenseActions { + constructor() { + this.generateActions( + 'updateLicenses' + ); + } + + fetchLicense() { + LicenseFetcher.fetch() + .then((res) => { + this.actions.updateLicenses(res.licenses); + }) + .catch((err) => { + console.log(err); + }); + } +} + +export default alt.createActions(LicenseActions); diff --git a/js/components/ascribe_forms/form.js b/js/components/ascribe_forms/form.js index 319214c1..e6db5405 100644 --- a/js/components/ascribe_forms/form.js +++ b/js/components/ascribe_forms/form.js @@ -130,15 +130,17 @@ let Form = React.createClass({ }, renderChildren() { return ReactAddons.Children.map(this.props.children, (child) => { - return ReactAddons.addons.cloneWithProps(child, { - handleChange: this.handleChangeChild, - ref: child.props.name - }); + if (child) { + return ReactAddons.addons.cloneWithProps(child, { + handleChange: this.handleChangeChild, + ref: child.props.name + }); + } }); }, render() { return ( -
diff --git a/js/constants/api_urls.js b/js/constants/api_urls.js index df3aac3f..46626f2d 100644 --- a/js/constants/api_urls.js +++ b/js/constants/api_urls.js @@ -14,6 +14,7 @@ let apiUrls = { 'edition_delete': AppConstants.apiEndpoint + 'editions/${edition_id}/', 'edition_remove_from_collection': AppConstants.apiEndpoint + 'ownership/shares/${edition_id}/', 'editions_list': AppConstants.apiEndpoint + 'pieces/${piece_id}/editions/', + 'licenses': AppConstants.apiEndpoint + 'ownership/licenses/', 'note_notes': AppConstants.apiEndpoint + 'note/notes/', 'note_edition': AppConstants.apiEndpoint + 'note/edition_notes/', 'ownership_consigns': AppConstants.apiEndpoint + 'ownership/consigns/', diff --git a/js/fetchers/license_fetcher.js b/js/fetchers/license_fetcher.js new file mode 100644 index 00000000..6b0cada0 --- /dev/null +++ b/js/fetchers/license_fetcher.js @@ -0,0 +1,14 @@ +'use strict'; + +import requests from '../utils/requests'; + +let LicenseFetcher = { + /** + * Fetch the available licenses from the API (might be bound to the subdomain e.g. cc.ascribe.io). + */ + fetch() { + return requests.get('licenses', {'subdomain': window.location.host.split('.')[0]}); + } +}; + +export default LicenseFetcher; diff --git a/js/stores/license_store.js b/js/stores/license_store.js new file mode 100644 index 00000000..42a6bfb5 --- /dev/null +++ b/js/stores/license_store.js @@ -0,0 +1,18 @@ +'use strict'; + +import alt from '../alt'; +import LicenseActions from '../actions/license_actions'; + + +class LicenseStore { + constructor() { + this.licenses = {}; + this.bindActions(LicenseActions); + } + + onUpdateLicenses(licenses) { + this.licenses = licenses; + } +} + +export default alt.createStore(LicenseStore, 'LicenseStore'); diff --git a/sass/ascribe_settings.scss b/sass/ascribe_settings.scss index 8e136338..bbd6dc77 100644 --- a/sass/ascribe_settings.scss +++ b/sass/ascribe_settings.scss @@ -127,3 +127,9 @@ padding: 0; } } + +.ascribe-property-footer{ + font-size: 0.8em; + margin-top: 10px; + width: 100%; +} \ No newline at end of file diff --git a/sass/ascribe_variables.scss b/sass/ascribe_variables.scss index 5caef006..87cccb7b 100644 --- a/sass/ascribe_variables.scss +++ b/sass/ascribe_variables.scss @@ -1,3 +1,6 @@ $ascribe-color: rgba(2, 182, 163, 0.5); $ascribe-color-dark: rgba(2, 182, 163, 0.8); -$ascribe-color-full: rgba(2, 182, 163, 1); \ No newline at end of file +$ascribe-color-full: rgba(2, 182, 163, 1); + +$ascribe-brand-danger: #FC535F; +$ascribe-brand-warning: #FFC354; \ No newline at end of file diff --git a/sass/main.scss b/sass/main.scss index eb5fd56f..37000d4f 100644 --- a/sass/main.scss +++ b/sass/main.scss @@ -3,8 +3,8 @@ $BASE_URL: '<%= BASE_URL %>'; -@import 'variables'; @import 'ascribe_variables'; +@import 'variables'; @import '../node_modules/bootstrap-sass/assets/stylesheets/bootstrap'; @import '../node_modules/react-datepicker/dist/react-datepicker'; @import './ascribe-fonts/style'; diff --git a/sass/variables.scss b/sass/variables.scss index f2d12e1f..b46f509f 100644 --- a/sass/variables.scss +++ b/sass/variables.scss @@ -18,8 +18,8 @@ $gray-lighter: lighten($gray-base, 93.5%) !default; // #eee $brand-primary: darken(#428bca, 6.5%) !default; // #337ab7 $brand-success: #5cb85c !default; $brand-info: #5bc0de !default; -$brand-warning: #f0ad4e !default; -$brand-danger: #d9534f !default; +$brand-warning: $ascribe-brand-warning !default; +$brand-danger: $ascribe-brand-danger !default; //== Scaffolding @@ -107,9 +107,9 @@ $padding-xs-horizontal: 5px !default; $line-height-large: 1.3333333 !default; // extra decimals for Win 8.1 Chrome $line-height-small: 1.5 !default; -$border-radius-base: 4px !default; -$border-radius-large: 6px !default; -$border-radius-small: 3px !default; +$border-radius-base: 0 !default; +$border-radius-large: 0 !default; +$border-radius-small: 0 !default; //** Global color for active items (e.g., navs or dropdowns). $component-active-color: #fff !default; @@ -149,9 +149,9 @@ $table-border-color: #ddd !default; $btn-font-weight: normal !default; -$btn-default-color: #333 !default; -$btn-default-bg: #fff !default; -$btn-default-border: #ccc !default; +$btn-default-color: white !default; +$btn-default-bg: $ascribe-color-full !default; +$btn-default-border: $ascribe-color-full !default; $btn-primary-color: #fff !default; $btn-primary-bg: $brand-primary !default; @@ -171,7 +171,7 @@ $btn-warning-border: darken($btn-warning-bg, 5%) !default; $btn-danger-color: #fff !default; $btn-danger-bg: $brand-danger !default; -$btn-danger-border: darken($btn-danger-bg, 5%) !default; +$btn-danger-border: $brand-danger !default; $btn-link-disabled-color: $gray-light !default; @@ -186,7 +186,7 @@ $input-bg: #fff !default; $input-bg-disabled: $gray-lighter !default; //** Text color for ``s -$input-color: $gray !default; +$input-color: white !default; //** `` border color $input-border: #ccc !default; @@ -219,9 +219,9 @@ $legend-color: $gray-dark !default; $legend-border-color: #e5e5e5 !default; //** Background color for textual input addons -$input-group-addon-bg: $gray-lighter !default; +$input-group-addon-bg: $ascribe-color-full !default; //** Border color for textual input addons -$input-group-addon-border-color: $input-border !default; +$input-group-addon-border-color: $ascribe-color-full !default; //** Disabled cursor for form controls and buttons. $cursor-disabled: not-allowed !default;