newsdev/adcom

Name: adcom

Owner: NYT Newsroom Developers

Description: Admin Components

Created: 2015-04-19 22:00:19.0

Updated: 2018-03-30 18:00:51.0

Pushed: 2017-02-27 16:25:27.0

Homepage: http://newsdev.github.io/adcom/

Size: 2112

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Adcom

Bower version

Adcom is a set of JavaScript plugins and frontend styles
that serve as the foundation for admins at The New York Times.

The plugins serve common use cases on the many internal sites we create day to day: rendering dynamic lists, standardizing form validation, maintaining state across page loads, persisting user settings, and so on.

The styles are a custom flavor of Bootstrap, and includes a set of guidelines for what to include on each page, and where. Ensuring that admins from all of our teams have a consistent visual language helps users feel more comfortable using the sites, and makes it easier for our developers to maintain.


Usage

Adcom is available over bower:

r install adcom

The dist folder of the source code contains the following files:

m/
dist/
??? css/
?   ??? adcom.css
?   ??? adcom.css.map
?   ??? adcom.min.css
??? js/
    ??? adcom.js
    ??? adcom.min.js

The adcom.css and adcom.min.css both include Bootstrap. adcom.js and adcom.min.js do not include the Bootstrap JavaScript plugins.


Plugins
JavaScript Usage

You can include all of the plugins or individual ones by loading either the distribution adcom.js file or any of the source files.

 load all of plugins -->
ipt src="dist/js/adcom.js"></script>

 load list.js only -->
ipt src="js/list.js"></script>
Require.js / AMD

Plugins are also compatible with the Asynchronous Module Definition API:

 using require.js -->
ipt src="require.js"></script>
ipt>
quire.config({
paths: {
  jquery: 'assets/jquery',
  adcom: 'assets/adcom'
}
;
quire(['adcom'], function() {
// all plugins are defined
;
ript>

Each assumes jQuery is available on the page or through require, and will install List.js to $.fn.list.

Plugin Initialization

Most plugins have a set of primary options can be specified in two ways:

For example, set the show option on a list by passing a boolean to the initailizer, or with a data attribute on the element:

When a plugin is initialized, all data attributes on the element are converted into options that get passed into the initializer as defaults. You can also mix and match; options specified in the JavaScript initializer take precedence over those as data attributes. Multi-word options are expressed in camel case in JavaScript (currentPage), and with hypens as data attributes (data-current-page).


Styles

Adcom includes CSS styles which are a compiled variation of Bootstrap. There are several modifications / additions Adcom makes to the following categories:

It also includes a boilerplate scaffold of the overall structure we use for admins at The New York Times.

Styles usage
 load adcom.css in your head tag -->
k rel="stylesheet" href="/assets/adcom.css">

Development

Make sure you have npm installed on your system. Then, run npm install within the project's home directory to install dependencies.

You also need to have bower installed to load Bootstrap as a dependency. Run bower install.

Grunt

Several grunt tasks are provided to make development easier.

Run grunt to compile the CSS and JavaScript, update the docs, and watch for new changes to the source files to re-run itself.

Run grunt jekyll:server to boot up this documentation on localhost:8000.

Contributing

Please use the Issues page to comment on the project and report any bugs or concerns you have.

License

Adcom is released under the Apache 2.0 License.

Author

Created by Michael Strickland for the Interactive News team at The New York Times.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.