jekyll-admin 0.10.1 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +2 -3
  3. data/lib/jekyll-admin/apiable.rb +1 -1
  4. data/lib/jekyll-admin/file_helper.rb +1 -6
  5. data/lib/jekyll-admin/public/asset-manifest.json +11 -11
  6. data/lib/jekyll-admin/public/index.html +1 -1
  7. data/lib/jekyll-admin/public/{precache-manifest.52de67482747a1012d0d27a209b930d0.js → precache-manifest.aff7726cf55090e9b1a563d77344218e.js} +9 -9
  8. data/lib/jekyll-admin/public/service-worker.js +1 -1
  9. data/lib/jekyll-admin/public/static/css/{main.223e267c.chunk.css → main.913a54c0.chunk.css} +2 -2
  10. data/lib/jekyll-admin/public/static/css/main.913a54c0.chunk.css.map +1 -0
  11. data/lib/jekyll-admin/public/static/js/2.dc118925.chunk.js +3 -0
  12. data/lib/jekyll-admin/public/static/js/{2.49911da2.chunk.js.LICENSE.txt → 2.dc118925.chunk.js.LICENSE.txt} +0 -0
  13. data/lib/jekyll-admin/public/static/js/2.dc118925.chunk.js.map +1 -0
  14. data/lib/jekyll-admin/public/static/js/main.2e88166c.chunk.js +2 -0
  15. data/lib/jekyll-admin/public/static/js/main.2e88166c.chunk.js.map +1 -0
  16. data/lib/jekyll-admin/server/collections.rb +1 -1
  17. data/lib/jekyll-admin/server/configuration.rb +1 -1
  18. data/lib/jekyll-admin/server/data.rb +1 -1
  19. data/lib/jekyll-admin/server/drafts.rb +1 -1
  20. data/lib/jekyll-admin/server/pages.rb +1 -1
  21. data/lib/jekyll-admin/server/static_files.rb +1 -1
  22. data/lib/jekyll-admin/version.rb +1 -1
  23. metadata +29 -16
  24. data/lib/jekyll-admin/public/static/css/main.223e267c.chunk.css.map +0 -1
  25. data/lib/jekyll-admin/public/static/js/2.49911da2.chunk.js +0 -3
  26. data/lib/jekyll-admin/public/static/js/2.49911da2.chunk.js.map +0 -1
  27. data/lib/jekyll-admin/public/static/js/main.dd81e877.chunk.js +0 -2
  28. data/lib/jekyll-admin/public/static/js/main.dd81e877.chunk.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["utils/metadata.js","assets/images/logo-black-red.png","constants/api.js","ducks/notifications.js","utils/apiErrors.js","translations/en.js","translations/index.js","utils/fetch.js","utils/validation.js","ducks/utils.js","utils/helpers.js","ducks/config.js","constants/keyboardShortcuts.js","components/Splitter.js","components/Icon.js","components/Accordion.js","ducks/collections.js","containers/Sidebar.js","constants/index.js","containers/Header.js","containers/Notifications.js","containers/App.js","components/FilePreview.js","components/Breadcrumbs.js","components/form/InputSearch.js","ducks/staticfiles.js","containers/views/StaticIndex.js","components/FilePicker.js","components/metadata/MetaTags.js","components/metadata/MetaSimple.js","components/metadata/MetaButtons.js","components/metadata/MetaObjectItem.js","components/metadata/MetaObject.js","components/metadata/MetaArrayItem.js","components/metadata/MetaArray.js","components/metadata/MetaField.js","ducks/metadata.js","ducks/siteMeta.js","containers/MetaFields.js","components/DataGUI.js","components/Editor.js","components/Errors.js","components/Button.js","containers/views/Configuration.js","components/Explorer.js","ducks/pages.js","containers/views/Pages.js","components/form/InputPath.js","components/form/InputTitle.js","utils/highlighter.js","components/MarkdownEditor.js","components/metadata/statics/StaticMetaSimple.js","components/metadata/statics/StaticMetaObjectItem.js","components/metadata/statics/StaticMetaObject.js","components/metadata/statics/StaticMetaArrayItem.js","components/metadata/statics/StaticMetaArray.js","components/metadata/statics/StaticMetaField.js","components/metadata/StaticMetaFields.js","components/MarkdownPageBody.js","containers/views/PageEdit.js","components/CreateMarkdownPage.js","containers/views/PageNew.js","containers/views/Documents.js","containers/views/DocumentEdit.js","containers/views/DocumentNew.js","ducks/datafiles.js","containers/views/DataFiles.js","containers/views/DataFileEdit.js","containers/views/DataFileNew.js","ducks/drafts.js","containers/views/Drafts.js","containers/views/DraftEdit.js","containers/views/DraftNew.js","components/Dropzone.js","containers/views/StaticFiles.js","containers/views/NotFound.js","routes.js","ducks/index.js","store.js","index.js"],"names":["addFieldToMetadata","state","namePrefix","tmpState","cloneDeep","field","eval","undefined","_","isArray","push","new_field_count","metadata","removeFieldFromMetadata","key","length","splice","has","updateMetadataFieldKey","fieldKey","newKey","Object","keys","reduce","result","current","updateMetadataFieldValue","nameAttr","value","convertMetadataField","convertType","moveMetadataArrayItem","srcInd","targetInd","arr","injectDefaultFields","config","path","type","defaults","front_matter","content","e","metafields","each","scope","extend","values","computeFieldType","specialKeys","includes","isObject","module","exports","API","putConfigurationUrl","pagesAPIUrl","directory","pageAPIUrl","filename","draftsAPIUrl","draftAPIUrl","collectionAPIUrl","collection_name","documentAPIUrl","datafilesAPIUrl","datafileAPIUrl","staticfilesAPIUrl","staticfileAPIUrl","addNotification","title","message","level","notification","BadInputError","name","stack","Error","getDeleteMessage","getLeaveMessage","getNotFoundMessage","getOverrideMessage","getParserErrorMessage","getSuccessMessage","getErrorMessage","getUploadSuccessMessage","getUploadErrorMessage","getFetchErrorMessage","getUpdateErrorMessage","getDeleteErrorMessage","getPublishDraftMessage","draftPath","postPath","getTitleRequiredMessage","getFilenameRequiredMessage","getContentRequiredMessage","getFilenameNotValidMessage","sidebar","pages","posts","drafts","datafiles","collections","staticfiles","configuration","labels","save","label","triggeredLabel","create","delete","publish","view","upload","viewToggle","translations","en","get","url","action_success","action_failure","dispatch","fetch","credentials","then","res","json","data","catch","error","put","body","method","error_message","del","id","DATE_FILENAME_MATCHER","FILENAME_MATCHER","validator","validations","messages","errorMessages","validationStr","list","validationArr","split","single","test","validated","filterBySearchInput","input","filter","p","toLowerCase","filterDeleted","item","relative_path","search","clearErrors","validationError","errors","toYAML","obj","isEmpty","yaml","safeDump","indent","capitalize","string","charAt","toUpperCase","substring","toTitleCase","replace","txt","substr","slugify","a","RegExp","join","toString","c","indexOf","getFilenameFromPath","lastIndexOf","getExtensionFromPath","index","preventDefault","event","trimObject","object","acc","trim","JSON","parse","Array","getDocumentTitle","splat","prefix","Boolean","computeRelativePath","fetchConfig","putConfig","source","getState","payload","raw_content","validateConfig","stringify","onEditorChange","Splitter","className","Icon","aria-hidden","Accordion","collapsed","handleClick","setState","this","props","counter","count","icon","minHeight","children","accordionClasses","classnames","panelHeight","style","maxHeight","onClick","renderIndicator","Component","defaultProps","fetchCollections","fetchCollection","fetchDocument","createDocument","collection","validateDocument","generateFilenameFromTitle","omit","preparePayload","putDocument","deleteDocument","date","moment","format","SidebarTranslations","Sidebar","hiddens","collectionItems","map","col","i","activeClassName","to","sidebar_label","itemsCount","hiddenLinks","link","translation","splitterBefore","defaultLinks","jekyll_admin","hidden_links","visibleLinks","difference","links","collectionsPanel","renderCollections","postsPanel","draftsPanel","show_drafts","connect","bindActionCreators","Header","target","process","Notifications","elementStyles","Containers","DefaultStyle","padding","width","textAlign","Title","fontSize","color","NotificationItem","margin","borderRadius","transition","success","backgroundColor","warning","info","Dismiss","top","right","height","border","opacity","notificationSystem","refs","nextProps","position","autoDismiss","ref","notifications","App","updated","isFetching","keyMap","keyboardShortcuts","FilePreview","onClickDelete","window","confirm","file","from_theme","handleClickDelete","node","isImageFile","src","http_url","alt","nodeLink","href","rel","renderFileOverlay","extname","Breadcrumbs","base","nodes","paths","before","slice","InputSearch","handleKeyPress","searchBy","onKeyPress","placeholder","fetchStaticFiles","uploadStaticFiles","files","reader","FileReader","readAsDataURL","onloadend","encoded_content","deleteStaticFile","filterByFilename","sf","StaticIndex","onClickStaticFile","modalView","renderDirectoryListingBtn","renderPreviewNode","utils","FilePicker","showModal","customStyles","overlay","zIndex","paddingTop","paddingRight","paddingLeft","openModal","shutModal","onPickItem","onPick","isOpen","contentLabel","onRequestClose","MetaTags","creators","handleKeyUp","pageTags","createTag","deleteTag","handleOnChange","tagInput","showSuggestions","autoSuggest","closeSuggestions","rectifyTag","tag","rectified","fieldValue","updateFieldValue","clone","tagName","pop","taginput","focus","suggestions","entry","startsWith","tags","suggests","suggestionClasses","visible","onChange","onFocus","onKeyUp","hidden","momentLocalizer","MetaSimple","handleEditableChange","handleDatepickerChange","dateStr","handleEditableBlur","imagepicker","handleLayoutChange","onBlur","dateValue","Date","siteMeta","renderEditable","layouts","defaultValue","renderDatepicker","renderStaticFilePicker","renderTagsInput","renderLayoutPicker","MetaButtons","dropdown","fieldTypes","simple","array","fieldTypeKeys","toggleDropdownState","onConvertClick","parentKey","ftype","onMouseDown","currentType","parentType","onRemoveClick","sortableHandle","dropdownClasses","tabIndex","renderDropdownItems","MetaObjectItem","convertField","updateFieldKey","currentValue","findDOMNode","field_key","removeField","addField","key_prefix","moveArrayItem","CurrentComponent","MetaArray","MetaObject","handleKeyBlur","handleConvertClick","handleRemoveClick","items","MetaArrayItem","data-id","component","options","draggable","group","pull","handle","animation","onEnd","getAttribute","newIndex","Sortable","sortableGroupDecorator","bind","MetaField","select","storeContentFields","updateTitle","updateBody","updatePath","fetchSiteMeta","MetaFields","fields","dataview","isEqual","site","visibleKeys","metafieldsClass","datafields","newWrapper","meta","DataGUI","handleChange","slug","ext","restricted","renderPathFields","Editor","editorChanged","nextState","ace","editor","getValue","mode","theme","showGutter","showPrintMargin","highlightActiveLine","scrollMargin","Errors","iconMap","Button","active","triggered","block","thin","btnClass","iconName","iconNode","Configuration","guiView","routerWillLeave","nextLocation","fieldChanged","toggleView","handleClickSave","router","route","setRouteLeaveHook","keyboardHandlers","handlers","renderContentBody","withRouter","Explorer","deleteItem","params","dir","browserHistory","renderTitleCell","renderDirectoryRow","renderFileRow","newBtnLabel","typeLabel","renderRows","fetchPages","fetchPage","createPage","validatePage","putPage","deletePage","Pages","InputFilename","tooltip","InputTitle","hljs","registerLanguage","require","classNames","MarkdownEditor","_replaceSelectedText","cm","headNTail","startPoint","getCursor","endPoint","text","getSelection","head","tail","replaceSelection","ch","setSelection","handleFilePick","codemirror","insertTexts","image","initialValue","destroy","onSave","opts","codeSyntaxHighlighting","toolbarIcons","action","filepicker","trigger","click","SimpleMDE","on","elementToRemove","container","querySelector","remove","display","StaticMetaSimple","disabled","FieldTypes","StaticMetaArray","StaticMetaObject","StaticMetaObjectItem","StaticMetaArrayItem","StaticMetaField","StaticMetaFields","filteredData","MarkdownPageBody","staticmetafields","PageEdit","new_path","page","front_matter_defaults","document_title","CreateMarkdownPage","onClickSave","metaType","defaultFields","PageNew","Documents","doc","modified_time","documents","renderTable","entries","DocumentEdit","currentDocument","DocumentNew","fetchDataFiles","fetchDataFile","putDataFile","validateDatafile","deleteDataFile","onDataFileChanged","DataFiles","DataFileEdit","datafileChanged","datafile","data_dir","gui","filepath","inputpath","data_path","guiSupport","renderAside","currentFile","DataFileNew","fetchDrafts","fetchDraft","putDraft","validateDraft","deleteDraft","publishDraft","Drafts","DraftEdit","draft","today","datedfilename","goTo","handleClickPublish","DraftNew","Dropzone","ReactDropzone","open","onDrop","onClickItem","multiple","disableClick","StaticFiles","openDropzone","dropzone","uploadedFiles","existingFiles","currentFiles","currentFilenames","cf","chain","existingUploadedFilenames","static_files","dirs","entity","concat","renderFilePreviewRow","NotFound","combineReducers","routing","routerReducer","Math","random","uploading","configureStore","createLogger","initialState","middlewares","thunk","createStore","rootReducer","compose","applyMiddleware","store","history","syncHistoryWithStore","render","routes","from","document","getElementById"],"mappings":"+4CAUaA,mBAAqB,SAArBA,mBAAsBC,MAAOC,YACxC,IAAIC,SAAWC,wDAAUH,OACrBI,MAAQC,KAAK,YAAD,OAAaJ,aAC7B,YAAcK,IAAVF,QACAG,kDAAEC,QAAQJ,OAAQA,MAAMK,KAAK,IAC5BL,MAAM,aAAD,OAAcJ,MAAMU,kBAAqB,IAFnBR,SAASS,UAc9BC,wBAA0B,SAA1BA,wBAA2BZ,MAAOC,WAAYY,KACzD,IAAIX,SAAWC,wDAAUH,OACrBI,MAAQC,KAAK,YAAD,OAAaJ,aAC7B,QAAcK,IAAVF,MAAqB,OAAOF,SAASS,SACzC,GAAIJ,kDAAEC,QAAQJ,OAAQ,CACpB,GAAIS,KAAOT,MAAMU,OACf,OAAOZ,SAASS,SAElBP,MAAMW,OAAOF,IAAK,OACb,CACL,IAAKN,kDAAES,IAAIZ,MAA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,eAEzB,QACE,OAAOxE,M2EiBE+qB,IAtCAC,OAEY,SAAAC,GACzB,IAAMC,EAAc,CAACC,MAErB,OAAOC,YACLC,GACAJ,EACAK,YAAQC,IAAe,WAAf,EAAmBL,OCHzBM,I,OAAQT,MACRU,GAAUC,+BAAqBhK,iBAAgB8J,IAErDG,iBACE,kBAAC,IAAD,CAAUH,MAAOA,IACf,kBAAC,SAAD,CAAQC,QAASA,GAASG,OAAQA,IAChC,kBAAC,WAAD,CAAUC,KAAI,U7DjBQ,S6DiBR,KAAsB9b,GAAE,U7DjBhB,S6DiBgB,eAG1C+b,SAASC,eAAe,W","file":"static/js/main.dd81e877.chunk.js","sourcesContent":["import _ from 'underscore';\nimport cloneDeep from 'lodash/cloneDeep';\n\n/**\n * Returns the metadata of the state with the new empty field. If the field does\n * not exist, returns the original metadata. Does not mutate the given state.\n * @param {Object} state\n * @param {String} namePrefix\n * @return {Object} metadata\n */\nexport const addFieldToMetadata = (state, namePrefix) => {\n let tmpState = cloneDeep(state);\n let field = eval(`tmpState.${namePrefix}`);\n if (field === undefined) return tmpState.metadata;\n if (_.isArray(field)) field.push('');\n else field[`New field ${state.new_field_count}`] = '';\n return tmpState.metadata;\n};\n\n/**\n * Returns the metadata of the state with the removed key. If the field does not\n * exist, returns the original metadata. Does not mutate the given state.\n * @param {Object} state\n * @param {String} namePrefix\n * @param {String} key\n * @return {Object} metadata\n */\nexport const removeFieldFromMetadata = (state, namePrefix, key) => {\n let tmpState = cloneDeep(state);\n let field = eval(`tmpState.${namePrefix}`);\n if (field === undefined) return tmpState.metadata;\n if (_.isArray(field)) {\n if (key >= field.length) {\n return tmpState.metadata;\n }\n field.splice(key, 1);\n } else {\n if (!_.has(field, key)) {\n return tmpState.metadata;\n }\n delete field[key];\n }\n return tmpState.metadata;\n};\n\n/**\n * Returns the metadata of the state with the updated key. If the field does not\n * exist or the key already exists, returns the original metadata. Does not\n * mutate the given state.\n * @param {Object} state\n * @param {String} namePrefix\n * @param {String} fieldKey\n * @param {String} newKey\n * @return {Object} metadata\n */\nexport const updateMetadataFieldKey = (state, namePrefix, fieldKey, newKey) => {\n let tmpState = cloneDeep(state);\n let field = eval(`tmpState.${namePrefix}`);\n if (field === undefined) return tmpState.metadata;\n if (_.has(field, newKey)) return tmpState.metadata;\n field = Object.keys(field).reduce((result, current) => {\n if (current === fieldKey) result[newKey] = field[current];\n else result[current] = field[current];\n return result;\n }, {});\n eval(`tmpState.${namePrefix} = field`);\n return tmpState.metadata;\n};\n\n/**\n * Returns the metadata of the state with the updated value of given path(nameAttr).\n * If the field does not exist, creates a new field. Does not mutate the given state.\n * @param {Object} state\n * @param {String} nameAttr\n * @param {String} value\n * @return {Object} metadata\n */\nexport const updateMetadataFieldValue = (state, nameAttr, value) => {\n let tmpState = cloneDeep(state);\n eval(`tmpState.${nameAttr} = value`);\n return tmpState.metadata;\n};\n\n/**\n * Returns the metadata of the state with the converted type of given path(nameAttr).\n * If the field does not exist, returns the original metadata.\n * Does not mutate the given state.\n * @param {Object} state\n * @param {String} nameAttr\n * @param {String} convertType\n * @return {Object} metadata\n */\nexport const convertMetadataField = (state, nameAttr, convertType) => {\n let tmpState = cloneDeep(state);\n let field = eval(`tmpState.${nameAttr}`);\n if (field === undefined) return tmpState.metadata;\n if (convertType === 'array') field = [''];\n else if (convertType === 'object') {\n let key = `New field ${state.new_field_count}`;\n field = { [key]: '' };\n } else field = '';\n eval(`tmpState.${nameAttr} = field`);\n return tmpState.metadata;\n};\n\n/**\n * Returns the metadata of the state with the sorted array. Moves the array item to\n * target index, shifts the rest of them. If the given path is not an array,\n * returns the original metadata. Does not mutate the given state.\n * @param {Object} state\n * @param {String} namePrefix\n * @param {Number} srcInd\n * @param {Number} targetInd\n * @return {Object} metadata\n */\nexport const moveMetadataArrayItem = (state, namePrefix, srcInd, targetInd) => {\n let tmpState = cloneDeep(state);\n let arr = eval(`tmpState.${namePrefix}`);\n if (!_.isArray(arr)) return tmpState.metadata;\n arr.splice(targetInd, 0, arr.splice(srcInd, 1)[0]);\n return tmpState.metadata;\n};\n\n/**\n * Injects the relevant default front matter fields read from the config file into\n * the provided front matter object\n * @param {Object} config\n * @param {String} path\n * @param {String} type\n * @param {Object} front_matter\n * @return {Object} metadata\n */\nexport const injectDefaultFields = (config, path, type, front_matter = {}) => {\n let defaults;\n try {\n defaults = config.content.defaults;\n } catch (e) {\n return {};\n }\n let metafields = {};\n _.each(defaults, field => {\n const scope = field.scope;\n if (\n (!scope.type || scope.type === type) &&\n (!scope.path || scope.path === path)\n ) {\n _.extend(metafields, field.values);\n }\n });\n return _.extend(metafields, front_matter);\n};\n\n/**\n * Given a field-value and corresponding key, this utility returns\n * metadata type for the pair.\n * @param {*} value\n * @param {String} key\n * @return {String} type\n */\nexport const computeFieldType = (value, key = null) => {\n let type = 'simple';\n const specialKeys = ['tags', 'categories'];\n if (specialKeys.includes(key) && _.isArray(value)) return type;\n\n if (_.isObject(value)) type = 'object';\n if (_.isArray(value)) type = 'array';\n return type;\n};\n","module.exports = \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAB5CAYAAACDSRyFAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZG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K4vLxud7zTu9q8W81SBqzEDEqK/LiJ02i0Q35uoibi1wUvYAAnwIZpAc9dpEN97Cb+FLB0ZGnPAYp6lK7yqGMc17Y+8rhVGQnzf4gzUR6oa4kz0xlqLbRkv6BNVxmqF0RDfl2iP6giqEvbHHRYbz5fhyYyutNeGQHynwLv/vhobaEf8ZT1QAcKx1EgI6CXjw6bctD9+gfnNzzD0x8f4wnKj8hp8ik6ohMynHYJhkCTFGIxX8RBeQE/8hBWQABswEB1REZlNOwbiW422/ibgCvw3H/GfZVjIAlHmvUr5TTsPCXh1Nj50tkO5qzbORU8shFgownd4HCeiOrZNWgN0wbfYCLG0BD/jBZyKmtCy20PGALN7wm8lDxQ8BfSbxcMAxxzLBIz38YdvFq85D5byZxcJeF0DSdIR/4iqohUOQQdfe5yMQ9BSn6JyuobYHx1xEbrgFlyB83Ec2uoEes7uz7wORPQjq+EZtPacwIfKJH7v0AKJragAfSBJbkBG0jRNewOSZBquClnr1g7Pwry85UpkNE3TtEuwCZKkFEPRE0/jBXyKmRDDLOwDTdO0rFQPL6IEYmkBumObpGmaVoCL0BujsQTrsBYL8DtewXHI+/4ftS4BbH1NbcMAAAAASUVORK5CYII=\"","export const API =\n process.env.NODE_ENV === 'production'\n ? '/_api'\n : 'http://localhost:4000/_api';\n\nexport const getSiteMetaUrl = () => `${API}/site_meta`;\n\nexport const getConfigurationUrl = () => `${API}/configuration`;\nexport const putConfigurationUrl = () => `${API}/configuration`;\n\nexport const pagesAPIUrl = (directory = '') => `${API}/pages/${directory}`;\nexport const pageAPIUrl = (directory, filename) =>\n directory\n ? `${API}/pages/${directory}/${filename}`\n : `${API}/pages/${filename}`;\n\nexport const draftsAPIUrl = (directory = '') => `${API}/drafts/${directory}`;\nexport const draftAPIUrl = (directory, filename) =>\n directory\n ? `${API}/drafts/${directory}/${filename}`\n : `${API}/drafts/${filename}`;\n\nexport const collectionsAPIUrl = () => `${API}/collections`;\nexport const collectionAPIUrl = (collection_name, directory) =>\n directory\n ? `${API}/collections/${collection_name}/entries/${directory}`\n : `${API}/collections/${collection_name}/entries`;\nexport const documentAPIUrl = (collection_name, directory, filename) =>\n directory\n ? `${API}/collections/${collection_name}/${directory}/${filename}`\n : `${API}/collections/${collection_name}/${filename}`;\n\nexport const datafilesAPIUrl = (directory = '') => `${API}/data/${directory}`;\nexport const datafileAPIUrl = (directory, filename) =>\n directory\n ? `${API}/data/${directory}/${filename}`\n : `${API}/data/${filename}`;\n\nexport const staticfilesAPIUrl = (directory = '') =>\n `${API}/static_files/${directory}`;\nexport const staticfileAPIUrl = (directory, filename) =>\n directory\n ? `${API}/static_files/${directory}/${filename}`\n : `${API}/static_files/${filename}`;\n","// Action Types\nexport const ADD_NOTIFICATION = 'ADD_NOTIFICATION';\n\n// Actions\nexport const addNotification = (title, message, level) => ({\n type: ADD_NOTIFICATION,\n notification: {\n title,\n message,\n level,\n },\n});\n\n// Reducer\nexport default function notifications(\n state = {\n notification: {},\n },\n action\n) {\n switch (action.type) {\n case ADD_NOTIFICATION:\n return {\n ...state,\n notification: action.notification,\n };\n default:\n return state;\n }\n}\n","export class BadInputError extends Error {\n constructor(message) {\n super();\n this.name = 'BadInputError';\n this.message = message || 'Bad input';\n this.stack = new Error().stack;\n }\n}\n","// inline messages\nexport const getDeleteMessage = filename =>\n `Are you sure that you want to delete \"${filename}\" ?`;\n\nexport const getLeaveMessage = () =>\n 'You have unsaved changes on this page. Are you sure you want to leave?';\n\nexport const getNotFoundMessage = type => `No ${type} found.`;\n\nexport const getOverrideMessage = filename =>\n `${filename} will be overwritten. Continue anyway?`;\n\n// notification messages\nexport const getParserErrorMessage = () => 'Parse Error';\n\nexport const getSuccessMessage = () => 'Success';\n\nexport const getErrorMessage = () => 'Error';\n\nexport const getUploadSuccessMessage = filename =>\n `${filename} uploaded successfully`;\n\nexport const getUploadErrorMessage = () => `Error occurred uploading the file.`;\n\nexport const getFetchErrorMessage = filename =>\n `Could not fetch the ${filename}`;\n\nexport const getUpdateErrorMessage = filename =>\n `Could not update the ${filename}`;\n\nexport const getDeleteErrorMessage = filename =>\n `Could not delete the ${filename}`;\n\nexport const getPublishDraftMessage = (draftPath, postPath) =>\n `'${draftPath}' will be converted to '${postPath}'`;\n\n// validation messages\nexport const getTitleRequiredMessage = () => 'The title is required.';\n\nexport const getFilenameRequiredMessage = () => 'The filename is required.';\n\nexport const getContentRequiredMessage = () => 'The content is required.';\n\nexport const getFilenameNotValidMessage = () => 'The filename is not valid.';\n\n// sidebar titles\nexport const sidebar = {\n pages: 'Pages',\n posts: 'Posts',\n drafts: 'Drafts',\n datafiles: 'Data Files',\n collections: 'Collections',\n staticfiles: 'Static Files',\n configuration: 'Configuration',\n};\n\n// button labels\nexport const labels = {\n save: {\n label: 'Save',\n triggeredLabel: 'Saved',\n },\n create: {\n label: 'Create',\n triggeredLabel: 'Created',\n },\n delete: {\n label: 'Delete',\n },\n publish: {\n label: 'Publish',\n },\n view: {\n label: 'View',\n },\n upload: {\n label: 'Upload files',\n },\n viewToggle: {\n label: 'Switch View to GUI Editor',\n triggeredLabel: 'Switch View to Raw Editor',\n },\n};\n","// TODO:\n// -------------------------------\n// import * as da from './da';\n// import * as es from './es';\n// import * as fr from './fr';\n// import * as ptBr from './ptBr';\n// import * as sv from './sv';\n\nimport * as en from './en';\n\nconst translations = en; // TODO: select language\nexport default translations;\n","import fetch from 'isomorphic-fetch';\nimport { addNotification } from '../ducks/notifications';\nimport { BadInputError } from './apiErrors';\n\nimport translations from '../translations';\nconst {\n getErrorMessage,\n getFetchErrorMessage,\n getUpdateErrorMessage,\n getDeleteErrorMessage,\n} = translations;\n\n/**\n * Fetch wrapper for GET request that dispatches actions according to the\n * request status\n * @param {String} url\n * @param {Object} action_success\n * @param {Object} action_failure\n * @return {Function} dispatch\n */\nexport const get = (url, action_success, action_failure, dispatch) => {\n return fetch(url, { credentials: 'same-origin' })\n .then(res => res.json())\n .then(data =>\n dispatch({\n type: action_success.type,\n [action_success.name]: data,\n })\n )\n .catch(error => {\n dispatch({\n type: action_failure.type,\n [action_failure.name]: error,\n });\n dispatch(\n addNotification(\n getErrorMessage(),\n getFetchErrorMessage(action_success.name),\n 'error'\n )\n );\n });\n};\n\n/**\n * Fetch wrapper for PUT request that dispatches actions according to the\n * request status\n * @param {String} url\n * @param {Object} body\n * @param {Object} action_success\n * @param {Object} action_failure\n * @return {Function} dispatch\n */\nexport const put = (url, body, action_success, action_failure, dispatch) => {\n return fetch(url, {\n method: 'PUT',\n credentials: 'same-origin',\n body,\n })\n .then(res => res.json())\n .then(data => {\n if (data.error_message) {\n throw new BadInputError(data.error_message);\n }\n dispatch({\n type: action_success.type,\n [action_success.name]: data,\n });\n })\n .catch(error => {\n dispatch({\n type: action_failure.type,\n [action_failure.name]: error,\n });\n let error_message =\n error.name === 'BadInputError'\n ? error.message\n : getUpdateErrorMessage(action_success.name);\n dispatch(addNotification(getErrorMessage(), error_message, 'error'));\n });\n};\n\n/**\n * Fetch wrapper for DELETE request that dispatches actions according to the\n * request status\n * @param {String} url\n * @param {Object} action_success\n * @param {Object} action_failure\n * @return {Function} dispatch\n */\nexport const del = (url, action_success, action_failure, dispatch) => {\n return fetch(url, {\n method: 'DELETE',\n credentials: 'same-origin',\n })\n .then(data =>\n dispatch({\n type: action_success.type,\n id: action_success.id,\n })\n )\n .catch(error => {\n dispatch({\n type: action_failure.type,\n [action_failure.name]: error,\n });\n dispatch(\n addNotification(\n getErrorMessage(),\n getDeleteErrorMessage(action_success.name),\n 'error'\n )\n );\n });\n};\n","import _ from 'underscore';\n\nconst DATE_FILENAME_MATCHER = /^(?:.+\\/)*(\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]))-(.*)(\\.[^.]+)$/;\nconst FILENAME_MATCHER = /^(.*)(\\.[^.]+)$/;\n\nconst validated = (field, single) => {\n switch (single) {\n case 'required':\n return !!field;\n case 'date':\n return DATE_FILENAME_MATCHER.test(field);\n case 'filename':\n return FILENAME_MATCHER.test(field);\n default:\n return false;\n }\n};\n\n/**\n * Returns error messages if the given values does not pass the provided validations.\n * @param {Object} values\n * @param {Object} validations\n * @param {Object} messages\n * @return {Array} errorMessages\n */\nexport const validator = (values, validations, messages) => {\n let errorMessages = [];\n _.each(validations, (validationStr, field, list) => {\n const validationArr = validationStr.split('|');\n _.each(validationArr, single => {\n if (!validated(values[field], single)) {\n errorMessages.push(messages[`${field}.${single}`]);\n }\n });\n });\n return errorMessages;\n};\n","// Selectors\nexport const filterBySearchInput = (list, input) => {\n if (input) {\n return list.filter(p => p.name.toLowerCase().includes(input.toLowerCase()));\n }\n return list;\n};\n\nexport const filterDeleted = (list, id) => {\n return list.filter(item => item.relative_path !== id);\n};\n\n// Action Types\nexport const SEARCH_CONTENT = 'SEARCH_CONTENT';\nexport const CLEAR_ERRORS = 'CLEAR_ERRORS';\nexport const VALIDATION_ERROR = 'VALIDATION_ERROR';\n\n// Actions\nexport const search = input => ({\n type: SEARCH_CONTENT,\n input,\n});\n\nexport const clearErrors = () => ({\n type: CLEAR_ERRORS,\n});\n\nexport const validationError = errors => ({\n type: VALIDATION_ERROR,\n errors,\n});\n\n// Reducer\nexport default function utils(\n state = {\n input: '',\n errors: [],\n },\n action\n) {\n switch (action.type) {\n case SEARCH_CONTENT:\n return {\n ...state,\n input: action.input,\n };\n case CLEAR_ERRORS:\n return {\n ...state,\n errors: [],\n };\n case VALIDATION_ERROR:\n return {\n ...state,\n errors: action.errors,\n };\n default:\n return {\n ...state,\n input: '',\n };\n }\n}\n","import yaml from 'js-yaml';\nimport _ from 'underscore';\n\n/**\n * Converts the object into YAML string.\n * @param {Object} object\n * @return {String} yaml\n */\nexport const toYAML = obj =>\n !_.isEmpty(obj) ? yaml.safeDump(obj, { indent: 2 }) : '';\n\n/**\n * Converts the YAML string into JS object.\n * @param {String} string\n * @return {Object} obj\n */\nexport const toJSON = yamlString => (yamlString ? yaml.load(yamlString) : {});\n\n/**\n * Capitalize the given string.\n * @param {String} string\n * @return {String} string\n */\nexport const capitalize = string => {\n if (!string) return '';\n return string.charAt(0).toUpperCase() + string.substring(1).toLowerCase();\n};\n\n/**\n * Convert the given string into title case format.\n * @param {String} string\n * @return {String} string\n */\nexport const toTitleCase = string => {\n if (!string) return '';\n return string.replace(/\\w\\S*/g, txt => {\n return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();\n });\n};\n\n/**\n * Slugify the given string\n * @param {String} string\n * @return {String} string\n */\nexport const slugify = string => {\n if (!string) return '';\n const a = 'àáäâèéëêìíïîıòóöôùúüûñçşßÿœæŕśńṕẃǵğǹḿǘẍźḧ·/_,:;';\n const b = 'aaaaeeeeiiiiioooouuuuncssyoarsnpwggnmuxzh------';\n const p = new RegExp(a.split('').join('|'), 'g');\n\n return string\n .toString()\n .toLowerCase()\n .replace(/\\s+/g, '-') // Replace spaces with -\n .replace(p, c => b.charAt(a.indexOf(c))) // Replace special chars\n .replace(/&/g, '-') // Replace & with 'and'\n .replace(/[^\\w-]+/g, '') // Remove all non-word chars\n .replace(/-+/g, '-') // Replace multiple - with single -\n .replace(/^-+/, '') // Trim - from start of text\n .replace(/-+$/, ''); // Trim - from end of text\n};\n\n/**\n * Returns filename from the given path\n * @param {String} path\n * @return {String} filename\n */\nexport const getFilenameFromPath = path => {\n if (!path) return '';\n return path.substring(path.lastIndexOf('/') + 1);\n};\n\n/**\n * Returns extension from the given path or filename\n * @param {String} path or filename\n * @return {String} extension or nil\n */\nexport const getExtensionFromPath = path => {\n if (!path) return '';\n const filename = getFilenameFromPath(path);\n const index = filename.lastIndexOf('.');\n\n if (index > 0) {\n return filename.substring(index + 1);\n } else {\n return '';\n }\n};\n\n/**\n * returns the uploaded static files that are being overwritten\n * @param {Array} uploadedFiles\n * @param {Array} currentFiles\n * @return {Array} filenames\n */\nexport const existingUploadedFilenames = (uploadedFiles, currentFiles) => {\n if (\n (uploadedFiles && !uploadedFiles.length) ||\n (currentFiles && !currentFiles.length)\n ) {\n return [];\n }\n const currentFilenames = _.map(currentFiles, cf =>\n getFilenameFromPath(cf.path)\n );\n return _.chain(uploadedFiles)\n .filter(file => currentFilenames.includes(file.name))\n .map(file => file.name)\n .value();\n};\n\n/**\n * Given an Event object, prevents the default event\n * from bubbling, if possible.\n * @param {Event} event\n */\nexport const preventDefault = event => {\n if (event && event.preventDefault) {\n event.preventDefault();\n }\n};\n\n/**\n * Given an object, trims every keys and values recursively.\n * @param {Object} object\n * @return {Object} trimmedObject\n */\nexport const trimObject = object => {\n if (!_.isObject(object)) return object;\n return _.keys(object).reduce((acc, key) => {\n if (typeof object[key] === 'string') {\n try {\n acc[key.trim()] = JSON.parse(object[key].trim());\n } catch (e) {\n acc[key.trim()] = object[key].trim();\n }\n } else {\n acc[key.trim()] = trimObject(object[key]);\n }\n return acc;\n }, Array.isArray(object) ? [] : {});\n};\n\n/**\n * Given a resource type and splat, returns a formatted title string.\n * Falsy values are discarded.\n * @param {String} type - Resource type.\n * @param {String} splat - Directory splat for current resource.\n * @param {String} [prefix=''] - Optional string text to be placed in front.\n * @return {String} Empty string or formatted title.\n */\nexport const getDocumentTitle = (type, splat, prefix = '') => {\n if (!type) return '';\n const label = toTitleCase(type.toString());\n return [prefix, splat, label].filter(Boolean).join(' | ');\n};\n\n/**\n * @param {String} directory - Directory splat for current resource.\n * @param {String} filename - Basename of current resource.\n * @return {String} Filename or directory splat joined to the filename.\n */\nexport const computeRelativePath = (directory, filename) => {\n return directory ? `${directory}/${filename}` : `${filename}`;\n};\n","import { getConfigurationUrl, putConfigurationUrl } from '../constants/api';\nimport { get, put } from '../utils/fetch';\nimport { validator } from '../utils/validation';\nimport { CLEAR_ERRORS, validationError } from './utils';\nimport { toYAML } from '../utils/helpers';\n\nimport translations from '../translations';\nconst { getContentRequiredMessage } = translations;\n\n// Action Types\nexport const FETCH_CONFIG_REQUEST = 'FETCH_CONFIG_REQUEST';\nexport const FETCH_CONFIG_SUCCESS = 'FETCH_CONFIG_SUCCESS';\nexport const FETCH_CONFIG_FAILURE = 'FETCH_CONFIG_FAILURE';\nexport const PUT_CONFIG_REQUEST = 'PUT_CONFIG_REQUEST';\nexport const PUT_CONFIG_SUCCESS = 'PUT_CONFIG_SUCCESS';\nexport const PUT_CONFIG_FAILURE = 'PUT_CONFIG_FAILURE';\nexport const CONFIG_EDITOR_CHANGED = 'CONFIG_EDITOR_CHANGED';\n\n// Actions\nexport const fetchConfig = () => dispatch => {\n dispatch({ type: FETCH_CONFIG_REQUEST });\n return get(\n getConfigurationUrl(),\n { type: FETCH_CONFIG_SUCCESS, name: 'config' },\n { type: FETCH_CONFIG_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const putConfig = (config, source = 'editor') => (\n dispatch,\n getState\n) => {\n let payload;\n\n if (source === 'gui') {\n config = getState().metadata.metadata;\n payload = { raw_content: toYAML(config) };\n } else {\n payload = { raw_content: config };\n }\n\n // handle errors\n const errors = validateConfig(config);\n if (errors.length) {\n return dispatch(validationError(errors));\n }\n dispatch({ type: CLEAR_ERRORS });\n\n return put(\n putConfigurationUrl(),\n JSON.stringify(payload),\n { type: PUT_CONFIG_SUCCESS, name: 'config' },\n { type: PUT_CONFIG_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nconst validateConfig = config =>\n validator(\n { config },\n { config: 'required' },\n {\n 'config.required': getContentRequiredMessage(),\n }\n );\n\nexport const onEditorChange = () => ({\n type: CONFIG_EDITOR_CHANGED,\n});\n\n// Reducer\nexport default function config(\n state = {\n config: {},\n updated: false,\n editorChanged: false,\n fieldChanged: false,\n isFetching: false,\n },\n action\n) {\n switch (action.type) {\n case FETCH_CONFIG_REQUEST:\n return {\n ...state,\n isFetching: true,\n };\n case FETCH_CONFIG_SUCCESS:\n return {\n ...state,\n config: action.config,\n isFetching: false,\n };\n case FETCH_CONFIG_FAILURE:\n return {\n ...state,\n isFetching: false,\n };\n case PUT_CONFIG_SUCCESS:\n return {\n ...state,\n config: action.config,\n editorChanged: false,\n updated: true,\n };\n case PUT_CONFIG_FAILURE:\n return {\n ...state,\n editorChanged: false,\n };\n case CONFIG_EDITOR_CHANGED:\n return {\n ...state,\n editorChanged: true,\n updated: false,\n };\n default:\n return {\n ...state,\n updated: false,\n editorChanged: false,\n };\n }\n}\n","export default {\n save: 'mod+s',\n};\n","import React from 'react';\n\nconst Splitter = () => <div className=\"splitter\" />;\n\nexport default Splitter;\n","import React from 'react';\nimport PropTypes from 'prop-types';\n\nexport default function Icon({ name }) {\n return <i className={`fa fa-${name}`} aria-hidden=\"true\" />;\n}\n\nIcon.propTypes = {\n name: PropTypes.string.isRequired,\n};\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport Icon from './Icon';\n\nclass Accordion extends Component {\n state = { collapsed: true };\n\n handleClick = () => {\n this.setState(state => {\n return {\n collapsed: !state.collapsed,\n };\n });\n };\n\n renderIndicator() {\n const { counter, count } = this.props;\n const { collapsed } = this.state;\n\n if (collapsed && counter && count) {\n return <div className=\"counter\">{count}</div>;\n }\n return (\n <div className=\"chevrons\">\n <Icon name={`chevron-${collapsed ? 'down' : 'up'}`} />\n </div>\n );\n }\n\n render() {\n const { icon, label, minHeight, count, children } = this.props;\n const { collapsed } = this.state;\n const accordionClasses = classnames('accordion', { collapsed });\n\n let panelHeight = minHeight;\n if (!collapsed) {\n panelHeight = minHeight && count ? (count + 1) * minHeight : 'none';\n }\n\n return (\n <div\n className={accordionClasses}\n style={{ maxHeight: panelHeight }}\n onClick={this.handleClick}\n >\n <div className=\"accordion-label\">\n {icon && <Icon name={icon} />}\n {label}\n <div className=\"indicator\">{this.renderIndicator()}</div>\n </div>\n {children}\n </div>\n );\n }\n}\n\nAccordion.defaultProps = {\n minHeight: 50,\n};\n\nAccordion.propTypes = {\n children: PropTypes.element.isRequired,\n label: PropTypes.string.isRequired,\n minHeight: PropTypes.number,\n count: PropTypes.number,\n counter: PropTypes.bool,\n icon: PropTypes.string,\n};\n\nexport default Accordion;\n","import _ from 'underscore';\nimport moment from 'moment';\nimport { CLEAR_ERRORS, validationError, filterDeleted } from './utils';\nimport { get, put, del } from '../utils/fetch';\nimport { validator } from '../utils/validation';\nimport { slugify, trimObject, computeRelativePath } from '../utils/helpers';\nimport {\n collectionsAPIUrl,\n collectionAPIUrl,\n documentAPIUrl,\n} from '../constants/api';\n\nimport translations from '../translations';\nconst {\n getTitleRequiredMessage,\n getFilenameRequiredMessage,\n getFilenameNotValidMessage,\n} = translations;\n\n// Action Types\nexport const FETCH_COLLECTIONS_REQUEST = 'FETCH_COLLECTIONS_REQUEST';\nexport const FETCH_COLLECTIONS_SUCCESS = 'FETCH_COLLECTIONS_SUCCESS';\nexport const FETCH_COLLECTIONS_FAILURE = 'FETCH_COLLECTIONS_FAILURE';\nexport const FETCH_COLLECTION_REQUEST = 'FETCH_COLLECTION_REQUEST';\nexport const FETCH_COLLECTION_SUCCESS = 'FETCH_COLLECTION_SUCCESS';\nexport const FETCH_COLLECTION_FAILURE = 'FETCH_COLLECTION_FAILURE';\nexport const FETCH_DOCUMENT_REQUEST = 'FETCH_DOCUMENT_REQUEST';\nexport const FETCH_DOCUMENT_SUCCESS = 'FETCH_DOCUMENT_SUCCESS';\nexport const FETCH_DOCUMENT_FAILURE = 'FETCH_DOCUMENT_FAILURE';\nexport const PUT_DOCUMENT_REQUEST = 'PUT_DOCUMENT_REQUEST';\nexport const PUT_DOCUMENT_SUCCESS = 'PUT_DOCUMENT_SUCCESS';\nexport const PUT_DOCUMENT_FAILURE = 'PUT_DOCUMENT_FAILURE';\nexport const DELETE_DOCUMENT_REQUEST = 'DELETE_DOCUMENT_REQUEST';\nexport const DELETE_DOCUMENT_SUCCESS = 'DELETE_DOCUMENT_SUCCESS';\nexport const DELETE_DOCUMENT_FAILURE = 'DELETE_DOCUMENT_FAILURE';\n\n// Actions\nexport const fetchCollections = () => dispatch => {\n dispatch({ type: FETCH_COLLECTIONS_REQUEST });\n return get(\n collectionsAPIUrl(),\n { type: FETCH_COLLECTIONS_SUCCESS, name: 'collections' },\n { type: FETCH_COLLECTIONS_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const fetchCollection = (\n collection_name,\n directory = ''\n) => dispatch => {\n dispatch({ type: FETCH_COLLECTION_REQUEST });\n return get(\n collectionAPIUrl(collection_name, directory),\n { type: FETCH_COLLECTION_SUCCESS, name: 'entries' },\n { type: FETCH_COLLECTION_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const fetchDocument = (\n collection_name,\n directory,\n filename\n) => dispatch => {\n dispatch({ type: FETCH_DOCUMENT_REQUEST });\n return get(\n documentAPIUrl(collection_name, directory, filename),\n { type: FETCH_DOCUMENT_SUCCESS, name: 'doc' },\n { type: FETCH_DOCUMENT_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const createDocument = (collection, directory) => (\n dispatch,\n getState\n) => {\n // get edited fields from metadata state\n const metadata = getState().metadata.metadata;\n let { path, raw_content, title } = metadata;\n // if path is not given or equals to directory, generate filename from the title\n if ((!path || `${path}/` === directory) && title) {\n path = generateFilenameFromTitle(metadata, collection); // override empty path\n } else {\n // validate otherwise\n const errors = validateDocument(metadata, collection);\n if (errors.length) {\n return dispatch(validationError(errors));\n }\n }\n // clear errors\n dispatch({ type: CLEAR_ERRORS });\n // omit raw_content, path and empty-value keys in metadata state from front_matter\n const front_matter = _.omit(metadata, (value, key, object) => {\n return key === 'raw_content' || key === 'path' || value === '';\n });\n // send the put request\n return put(\n // create or update document according to filename existence\n documentAPIUrl(collection, directory, path),\n preparePayload({ raw_content, front_matter }),\n { type: PUT_DOCUMENT_SUCCESS, name: 'doc' },\n { type: PUT_DOCUMENT_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const putDocument = (collection, directory, filename) => (\n dispatch,\n getState\n) => {\n // get edited fields from metadata state\n const metadata = getState().metadata.metadata;\n let { path, raw_content, title } = metadata;\n // if path is not given or equals to directory, generate filename from the title\n if ((!path || `${path}/` === directory) && title) {\n path = generateFilenameFromTitle(metadata, collection); // override empty path\n } else {\n // validate otherwise\n const errors = validateDocument(metadata, collection);\n if (errors.length) {\n return dispatch(validationError(errors));\n }\n }\n // clear errors\n dispatch({ type: CLEAR_ERRORS });\n // omit raw_content, path and empty-value keys in metadata state from front_matter\n const front_matter = _.omit(metadata, (value, key, object) => {\n return key === 'raw_content' || key === 'path' || value === '';\n });\n // add collection type prefix to relative path\n const relative_path = directory\n ? `_${collection}/${directory}/${path}`\n : `_${collection}/${path}`;\n // send the put request\n return put(\n // create or update document according to filename existence\n documentAPIUrl(collection, directory, filename),\n preparePayload({ path: relative_path, raw_content, front_matter }),\n { type: PUT_DOCUMENT_SUCCESS, name: 'doc' },\n { type: PUT_DOCUMENT_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const deleteDocument = (collection, directory, filename) => dispatch => {\n const relative_path = computeRelativePath(directory, filename);\n return del(\n documentAPIUrl(collection, directory, filename),\n { type: DELETE_DOCUMENT_SUCCESS, name: 'doc', id: relative_path },\n { type: DELETE_DOCUMENT_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nconst generateFilenameFromTitle = (metadata, collection) => {\n if (collection === 'posts') {\n // if date is provided, use it, otherwise generate it with today's date\n let date;\n if (metadata.date) {\n date = metadata.date.split(' ')[0];\n } else {\n date = moment().format('YYYY-MM-DD');\n }\n return `${date}-${slugify(metadata.title)}.md`;\n }\n return `${slugify(metadata.title)}.md`;\n};\n\nconst validateDocument = (metadata, collection) => {\n let validations = { title: 'required' }; // base validations\n // base messages\n let messages = {\n 'title.required': getTitleRequiredMessage(),\n 'path.required': getFilenameRequiredMessage(),\n };\n\n if (collection === 'posts') {\n validations['path'] = 'required|date';\n messages['path.date'] = getFilenameNotValidMessage();\n } else {\n validations['path'] = 'required|filename';\n messages['path.filename'] = getFilenameNotValidMessage();\n }\n return validator(metadata, validations, messages);\n};\n\nconst preparePayload = obj => JSON.stringify(trimObject(obj));\n\n// Reducer\nexport default function collections(\n state = {\n collections: [],\n entries: [],\n currentDocument: {},\n isFetching: false,\n updated: false,\n },\n action\n) {\n switch (action.type) {\n case FETCH_COLLECTIONS_REQUEST:\n case FETCH_COLLECTION_REQUEST:\n case FETCH_DOCUMENT_REQUEST:\n return {\n ...state,\n isFetching: true,\n };\n case FETCH_COLLECTIONS_SUCCESS:\n return {\n ...state,\n collections: action.collections,\n isFetching: false,\n };\n case FETCH_COLLECTION_SUCCESS:\n return {\n ...state,\n entries: action.entries,\n isFetching: false,\n };\n case FETCH_DOCUMENT_SUCCESS:\n return {\n ...state,\n currentDocument: action.doc,\n isFetching: false,\n };\n case FETCH_COLLECTIONS_FAILURE:\n return {\n ...state,\n collections: [],\n isFetching: false,\n };\n case FETCH_COLLECTION_FAILURE:\n return {\n ...state,\n entries: [],\n isFetching: false,\n };\n case FETCH_DOCUMENT_FAILURE:\n return {\n ...state,\n currentDocument: {},\n isFetching: false,\n };\n case PUT_DOCUMENT_SUCCESS:\n return {\n ...state,\n currentDocument: action.doc,\n updated: true,\n };\n case DELETE_DOCUMENT_SUCCESS:\n return {\n ...state,\n entries: filterDeleted(state.entries, action.id),\n };\n default:\n return {\n ...state,\n updated: false,\n };\n }\n}\n\n// Selectors\nexport const filterBySearchInput = (list, input) => {\n if (!list) {\n return [];\n }\n if (input) {\n return _.filter(list, item => {\n if (item.type) {\n return item.name.toLowerCase().includes(input.toLowerCase());\n } else {\n return item.title.toLowerCase().includes(input.toLowerCase());\n }\n });\n }\n return list;\n};\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { Link } from 'react-router';\nimport { ADMIN_PREFIX } from '../constants';\nimport Splitter from '../components/Splitter';\nimport Icon from '../components/Icon';\nimport Accordion from '../components/Accordion';\nimport { fetchCollections } from '../ducks/collections';\nimport { capitalize } from '../utils/helpers';\nimport _ from 'underscore';\n\nimport translations from '../translations';\nconst SidebarTranslations = translations.sidebar;\n\nexport class Sidebar extends Component {\n componentDidMount() {\n const { fetchCollections } = this.props;\n fetchCollections();\n }\n\n renderCollections(hiddens = []) {\n const { collections } = this.props;\n\n if (!collections.length) {\n return null;\n }\n\n const collectionItems = _.map(collections, (col, i) => {\n if (col.label !== 'posts' && !hiddens.includes(col.label)) {\n return (\n <li key={i}>\n <Link\n activeClassName=\"active\"\n to={`${ADMIN_PREFIX}/collections/${col.label}`}\n >\n <Icon name=\"book\" />\n {col.sidebar_label || capitalize(col.label)}\n </Link>\n </li>\n );\n }\n }).filter(Boolean);\n\n const itemsCount = collectionItems.length;\n if (!itemsCount) {\n return null;\n }\n\n return (\n <Accordion\n count={itemsCount}\n icon=\"briefcase\"\n label={SidebarTranslations.collections}\n counter\n >\n <ul>{collectionItems}</ul>\n </Accordion>\n );\n }\n\n render() {\n const { config } = this.props;\n\n const defaults = {\n pages: {\n icon: 'file-text',\n link: 'pages',\n translation: 'pages',\n },\n datafiles: {\n icon: 'database',\n link: 'datafiles',\n translation: 'datafiles',\n splitterBefore: true,\n },\n staticfiles: {\n icon: 'file',\n link: 'staticfiles',\n translation: 'staticfiles',\n },\n configuration: {\n icon: 'cog',\n link: 'configuration',\n translation: 'configuration',\n splitterBefore: true,\n },\n };\n\n const defaultLinks = _.keys(defaults);\n let hiddenLinks;\n\n try {\n hiddenLinks = config.jekyll_admin.hidden_links || [];\n } catch (e) {\n hiddenLinks = [];\n }\n\n const visibleLinks = _.difference(defaultLinks, hiddenLinks);\n\n const links = [];\n _.each(visibleLinks, (link, index, list) => {\n const current = defaults[link];\n if (current.splitterBefore) {\n links.push(<Splitter key={'splitter' + index} />);\n }\n links.push(\n <li key={index}>\n <Link activeClassName=\"active\" to={`${ADMIN_PREFIX}/${current.link}`}>\n <Icon name={current.icon} />\n {SidebarTranslations[current.translation]}\n </Link>\n </li>\n );\n });\n\n const collectionsPanel = this.renderCollections(hiddenLinks);\n const postsPanel = !hiddenLinks.includes('posts');\n const draftsPanel = config && config.show_drafts;\n\n return (\n <div className=\"sidebar\">\n <Link className=\"logo\" to={`${ADMIN_PREFIX}/pages`} />\n <ul className=\"routes\">\n {collectionsPanel}\n {postsPanel && (\n <li>\n <Link\n activeClassName=\"active\"\n to={`${ADMIN_PREFIX}/collections/posts`}\n >\n <Icon name=\"book\" />\n {SidebarTranslations.posts}\n </Link>\n </li>\n )}\n {draftsPanel && (\n <li>\n <Link activeClassName=\"active\" to={`${ADMIN_PREFIX}/drafts`}>\n <Icon name=\"edit\" />\n {SidebarTranslations.drafts}\n </Link>\n </li>\n )}\n {(collectionsPanel || postsPanel || draftsPanel) && <Splitter />}\n {links}\n </ul>\n </div>\n );\n }\n}\n\nSidebar.propTypes = {\n collections: PropTypes.array.isRequired,\n fetchCollections: PropTypes.func.isRequired,\n config: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n collections: state.collections.collections,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n fetchCollections,\n },\n dispatch\n );\n\nexport default connect(mapStateToProps, mapDispatchToProps)(Sidebar);\n","export const ADMIN_PREFIX = '/admin';\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { Link } from 'react-router';\nimport Icon from '../components/Icon';\n\nexport class Header extends Component {\n render() {\n const { config } = this.props;\n return (\n <div className=\"header\">\n <h3 className=\"title\">\n <Link target=\"_blank\" to={config.url || '/'}>\n <Icon name=\"home\" />\n <span>{config.title || 'You have no title!'}</span>\n </Link>\n </h3>\n <span className=\"version\">v{process.env.REACT_APP_VERSION}</span>\n </div>\n );\n }\n}\n\nHeader.propTypes = {\n config: PropTypes.object.isRequired,\n};\n\nexport default Header;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport NotificationSystem from 'react-notification-system';\n\nexport class Notifications extends Component {\n componentDidMount() {\n this.notificationSystem = this.refs.notificationSystem;\n }\n\n componentWillReceiveProps(nextProps) {\n const { notification } = nextProps;\n this.notificationSystem.addNotification({\n title: notification.title,\n message: notification.message,\n level: notification.level,\n position: 'br',\n autoDismiss: 10,\n });\n }\n\n elementStyles = {\n Containers: {\n DefaultStyle: {\n padding: 15,\n width: 360,\n textAlign: 'center',\n },\n },\n Title: {\n DefaultStyle: {\n fontSize: 21,\n color: '#fff',\n },\n },\n NotificationItem: {\n DefaultStyle: {\n margin: 0,\n padding: '9px 15px 15px',\n fontSize: 15,\n borderRadius: 0,\n transition: '0.5s ease-in-out',\n },\n success: {\n color: '#fff',\n backgroundColor: '#088217',\n },\n error: {\n color: '#fff',\n backgroundColor: '#e21414',\n },\n warning: {\n color: '#fff',\n backgroundColor: '#ebad1a',\n },\n info: {\n color: '#fff',\n backgroundColor: '#369cc7',\n },\n },\n Dismiss: {\n DefaultStyle: {\n top: 7,\n right: 9,\n width: 25,\n height: 25,\n padding: 4,\n backgroundColor: 'transparent',\n border: '2px solid',\n opacity: '0.84',\n },\n },\n };\n\n render() {\n return (\n <NotificationSystem ref=\"notificationSystem\" style={this.elementStyles} />\n );\n }\n}\n\nNotifications.propTypes = {\n notification: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n notification: state.notifications.notification,\n});\n\nexport default connect(mapStateToProps)(Notifications);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { HotKeys } from 'react-hotkeys';\nimport DocumentTitle from 'react-document-title';\n\nimport { fetchConfig } from '../ducks/config';\nimport keyboardShortcuts from '../constants/keyboardShortcuts';\n\n// Components\nimport Sidebar from './Sidebar';\nimport Header from './Header';\nimport Notifications from './Notifications';\n\nclass App extends Component {\n componentDidMount() {\n const { fetchConfig } = this.props;\n fetchConfig();\n }\n\n componentWillReceiveProps(nextProps) {\n if (this.props.updated !== nextProps.updated) {\n const { fetchConfig } = this.props;\n fetchConfig();\n }\n }\n\n render() {\n const { config, isFetching } = this.props;\n\n if (isFetching) {\n return null;\n }\n\n return (\n <DocumentTitle title=\"Jekyll Admin\">\n <HotKeys keyMap={keyboardShortcuts} className=\"wrapper\">\n {config.content && (\n <div>\n <Sidebar config={config.content} />\n <div className=\"container\">\n <Header config={config.content} />\n <div className=\"content\">{this.props.children}</div>\n </div>\n <Notifications />\n </div>\n )}\n </HotKeys>\n </DocumentTitle>\n );\n }\n}\n\nApp.propTypes = {\n children: PropTypes.element,\n fetchConfig: PropTypes.func.isRequired,\n config: PropTypes.object.isRequired,\n isFetching: PropTypes.bool.isRequired,\n updated: PropTypes.bool,\n};\n\nconst mapStateToProps = state => ({\n config: state.config.config,\n updated: state.config.updated,\n isFetching: state.config.isFetching,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators({ fetchConfig }, dispatch);\n\nexport default connect(mapStateToProps, mapDispatchToProps)(App);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { getFilenameFromPath } from '../utils/helpers';\nimport Icon from './Icon';\n\nimport translations from '../translations';\nconst { getDeleteMessage } = translations;\n\nexport default class FilePreview extends Component {\n handleClickDelete(path) {\n const { splat, onClickDelete } = this.props;\n const filename = getFilenameFromPath(path);\n const confirm = window.confirm(getDeleteMessage(path));\n confirm && onClickDelete(splat, filename);\n }\n\n renderFileOverlay(file, splat) {\n if (file.from_theme) {\n return (\n <span className=\"theme-indicator\" title=\"Theme Asset\">\n <Icon name=\"diamond\" />\n </span>\n );\n } else if (splat !== 'index') {\n return (\n <button\n onClick={() => this.handleClickDelete(file.relative_path)}\n className=\"delete\"\n title=\"Delete file\"\n >\n x\n </button>\n );\n }\n }\n\n get isImageFile() {\n const {\n file: { type, extname },\n } = this.props;\n if (type === 'directory') {\n return false;\n }\n\n return /png|jpg|gif|jpeg|svg|ico/i.test(extname.substring(1));\n }\n\n render() {\n const { onClick, file, splat } = this.props;\n const node = this.isImageFile ? (\n <img src={file.http_url} alt={file.relative_path} />\n ) : (\n <div>\n <Icon name=\"file-text-o\" />\n </div>\n );\n\n const nodeLink = onClick ? (\n <a onClick={() => onClick(file.relative_path)}>{node}</a>\n ) : (\n <a href={file.http_url} target=\"_blank\" rel=\"noopener noreferrer\">\n {node}\n </a>\n );\n\n const filename = splat === 'index' ? file.relative_path : file.name;\n\n return (\n <div className=\"file-preview\">\n {this.renderFileOverlay(file, splat)}\n {nodeLink}\n <span className=\"filename\">{filename}</span>\n </div>\n );\n }\n}\n\nFilePreview.propTypes = {\n file: PropTypes.object.isRequired,\n splat: PropTypes.string.isRequired,\n onClickDelete: PropTypes.func,\n onClick: PropTypes.func,\n};\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Link } from 'react-router';\nimport { toTitleCase } from '../utils/helpers';\nimport { ADMIN_PREFIX } from '../constants';\n\nexport default function Breadcrumbs({ type, splat = '' }) {\n const nonCollectionTypes = ['pages', 'datafiles', 'drafts', 'staticfiles'];\n const base = nonCollectionTypes.includes(type)\n ? `${ADMIN_PREFIX}/${type}`\n : `${ADMIN_PREFIX}/collections/${type}`;\n\n let label = type;\n if (type === 'datafiles') {\n label = 'data files';\n } else if (type === 'staticfiles') {\n label = 'static files';\n }\n\n let nodes = [];\n if (splat) {\n const paths = splat.split('/');\n nodes = paths.map((path, i) => {\n const before = i === 0 ? '' : paths.slice(0, i).join('/') + '/';\n return (\n <li key={i}>\n <Link to={`${base}/${before}${path}`}>{path}</Link>\n </li>\n );\n });\n }\n\n return (\n <ul className=\"breadcrumbs\">\n <li>\n <Link to={base}>{toTitleCase(label)}</Link>\n </li>\n {nodes}\n </ul>\n );\n}\n\nBreadcrumbs.propTypes = {\n type: PropTypes.string.isRequired,\n splat: PropTypes.string,\n};\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\nexport default class InputSearch extends Component {\n handleKeyPress = event => {\n const { search } = this.props;\n search(event.target.value);\n };\n\n render() {\n const { searchBy } = this.props;\n return (\n <input\n onKeyPress={this.handleKeyPress}\n type=\"text\"\n className=\"field\"\n placeholder={`Search by ${searchBy}`}\n />\n );\n }\n}\n\nInputSearch.propTypes = {\n search: PropTypes.func.isRequired,\n searchBy: PropTypes.string.isRequired,\n};\n","import _ from 'underscore';\nimport { filterDeleted } from './utils';\nimport { get, del } from '../utils/fetch';\nimport { computeRelativePath } from '../utils/helpers';\nimport { addNotification } from './notifications';\nimport { staticfilesAPIUrl, staticfileAPIUrl } from '../constants/api';\n\nimport translations from '../translations';\nconst {\n getSuccessMessage,\n getErrorMessage,\n getUploadSuccessMessage,\n getUploadErrorMessage,\n} = translations;\n\n// Action Types\nexport const FETCH_STATICFILES_REQUEST = 'FETCH_STATICFILES_REQUEST';\nexport const FETCH_STATICFILES_SUCCESS = 'FETCH_STATICFILES_SUCCESS';\nexport const FETCH_STATICFILES_FAILURE = 'FETCH_STATICFILES_FAILURE';\nexport const FETCH_STATICFILE_REQUEST = 'FETCH_STATICFILE_REQUEST';\nexport const FETCH_STATICFILE_SUCCESS = 'FETCH_STATICFILE_SUCCESS';\nexport const FETCH_STATICFILE_FAILURE = 'FETCH_STATICFILE_FAILURE';\nexport const PUT_STATICFILE_REQUEST = 'PUT_STATICFILE_REQUEST';\nexport const PUT_STATICFILE_SUCCESS = 'PUT_STATICFILE_SUCCESS';\nexport const PUT_STATICFILE_FAILURE = 'PUT_STATICFILE_FAILURE';\nexport const DELETE_STATICFILE_REQUEST = 'DELETE_STATICFILE_REQUEST';\nexport const DELETE_STATICFILE_SUCCESS = 'DELETE_STATICFILE_SUCCESS';\nexport const DELETE_STATICFILE_FAILURE = 'DELETE_STATICFILE_FAILURE';\n\n// Actions\nexport const fetchStaticFiles = (directory = '') => dispatch => {\n dispatch({ type: FETCH_STATICFILES_REQUEST });\n return get(\n staticfilesAPIUrl(directory),\n { type: FETCH_STATICFILES_SUCCESS, name: 'files' },\n { type: FETCH_STATICFILES_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const uploadStaticFiles = (directory, files) => dispatch => {\n _.each(files, file => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onloadend = () => {\n const payload = JSON.stringify({\n encoded_content: reader.result.split('base64,')[1],\n });\n // send the put request\n return fetch(staticfileAPIUrl(directory, file.name), {\n method: 'PUT',\n body: payload,\n credentials: 'same-origin',\n })\n .then(data => {\n dispatch({ type: PUT_STATICFILE_SUCCESS });\n dispatch(fetchStaticFiles(directory));\n dispatch(\n addNotification(\n getSuccessMessage(),\n getUploadSuccessMessage(file.name),\n 'success'\n )\n );\n })\n .catch(error => {\n dispatch({\n type: PUT_STATICFILE_FAILURE,\n error,\n });\n dispatch(\n addNotification(getErrorMessage(), getUploadErrorMessage(), 'error')\n );\n });\n };\n });\n};\n\nexport const deleteStaticFile = (directory, filename) => dispatch => {\n const relative_path = computeRelativePath(directory, filename);\n return del(\n staticfileAPIUrl(directory, filename),\n { type: DELETE_STATICFILE_SUCCESS, name: 'file', id: relative_path },\n { type: DELETE_STATICFILE_FAILURE, name: 'error' },\n dispatch\n );\n};\n\n// Reducer\nexport default function staticfiles(\n state = {\n files: [],\n isFetching: false,\n uploading: false, // TODO show loading gif\n },\n action\n) {\n switch (action.type) {\n case FETCH_STATICFILES_REQUEST:\n return {\n ...state,\n isFetching: true,\n };\n case FETCH_STATICFILES_SUCCESS:\n return {\n ...state,\n files: action.files,\n isFetching: false,\n };\n case FETCH_STATICFILES_FAILURE:\n return {\n ...state,\n isFetching: false,\n };\n case PUT_STATICFILE_REQUEST:\n return {\n ...state,\n uploading: true,\n };\n case PUT_STATICFILE_SUCCESS:\n return {\n ...state,\n uploading: false,\n };\n case PUT_STATICFILE_FAILURE:\n return {\n ...state,\n uploading: false,\n };\n case DELETE_STATICFILE_SUCCESS:\n return {\n ...state,\n files: filterDeleted(state.files, action.id),\n };\n default:\n return state;\n }\n}\n\n// Selectors\nexport const filterByFilename = (staticfiles, input) => {\n if (input) {\n return staticfiles.filter(sf =>\n sf.path.toLowerCase().includes(input.toLowerCase())\n );\n }\n return staticfiles;\n};\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { Link } from 'react-router';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport DocumentTitle from 'react-document-title';\nimport Icon from '../../components/Icon';\nimport FilePreview from '../../components/FilePreview';\nimport Breadcrumbs from '../../components/Breadcrumbs';\nimport InputSearch from '../../components/form/InputSearch';\nimport { search } from '../../ducks/utils';\nimport { fetchStaticFiles, filterByFilename } from '../../ducks/staticfiles';\nimport { ADMIN_PREFIX } from '../../constants';\n\nexport class StaticIndex extends Component {\n componentDidMount() {\n const { fetchStaticFiles } = this.props;\n fetchStaticFiles('index');\n }\n\n renderDirectoryListingBtn() {\n const to = `${ADMIN_PREFIX}/staticfiles`;\n\n return (\n <div className=\"page-buttons\">\n <Link className=\"btn btn-view\" to={to}>\n Directory Listing\n </Link>\n </div>\n );\n }\n\n renderPreviewNode() {\n const { files, onClickStaticFile } = this.props;\n\n if (files.length) {\n return (\n <div className=\"preview-container\">\n {files.map((file, i) => {\n return (\n <FilePreview\n key={i}\n onClick={onClickStaticFile}\n splat=\"index\"\n file={file}\n />\n );\n })}\n </div>\n );\n } else {\n return (\n <div className=\"preview-info\">\n <Icon name=\"exclamation-triangle\" />\n <h2>No files found!</h2>\n <h4>\n Upload files at 'Directory Listing' to have them displayed here.\n </h4>\n </div>\n );\n }\n }\n\n render() {\n const { isFetching, search, modalView } = this.props;\n\n if (isFetching) {\n return null;\n }\n\n return (\n <DocumentTitle title=\"Static File Listing\">\n <div>\n <div className=\"content-header\">\n <Breadcrumbs type=\"staticfiles\" />\n {!modalView && this.renderDirectoryListingBtn()}\n <div className=\"pull-right\">\n <InputSearch searchBy=\"filename\" search={search} />\n </div>\n </div>\n <div className=\"static-list\">{this.renderPreviewNode()}</div>\n </div>\n </DocumentTitle>\n );\n }\n}\n\nStaticIndex.propTypes = {\n files: PropTypes.array.isRequired,\n isFetching: PropTypes.bool.isRequired,\n fetchStaticFiles: PropTypes.func.isRequired,\n search: PropTypes.func.isRequired,\n onClickStaticFile: PropTypes.func,\n modalView: PropTypes.bool,\n};\n\nconst mapStateToProps = state => ({\n files: filterByFilename(state.staticfiles.files, state.utils.input),\n isFetching: state.staticfiles.isFetching,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n fetchStaticFiles,\n search,\n },\n dispatch\n );\n\nexport default connect(mapStateToProps, mapDispatchToProps)(StaticIndex);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport Modal from 'react-modal';\nimport StaticIndex from '../containers/views/StaticIndex';\nimport Icon from './Icon';\n\nexport default class FilePicker extends Component {\n state = {\n showModal: false,\n };\n\n customStyles = {\n overlay: {\n backgroundColor: 'rgba(0,0,0,0.6)',\n zIndex: 10,\n },\n content: {\n margin: 20,\n paddingTop: 0,\n paddingRight: 10,\n paddingLeft: 15,\n },\n };\n\n openModal = () => this.setState({ showModal: true });\n shutModal = () => this.setState({ showModal: false });\n\n onPickItem = path => {\n this.props.onPick(path);\n this.shutModal();\n };\n\n render() {\n return (\n <span className=\"images-wrapper\">\n <button onClick={this.openModal} ref=\"trigger\">\n <Icon name=\"picture-o\" />\n </button>\n <Modal\n isOpen={this.state.showModal}\n contentLabel=\"FilePicker\"\n onRequestClose={this.shutModal}\n style={this.customStyles}\n >\n <div className=\"content\">\n <StaticIndex onClickStaticFile={this.onPickItem} modalView />\n </div>\n </Modal>\n </span>\n );\n }\n}\n\nFilePicker.propTypes = {\n onPick: PropTypes.func.isRequired,\n};\n","import React, { Component, PropTypes } from 'react';\nimport TextareaAutosize from 'react-textarea-autosize';\nimport classnames from 'classnames';\n\nimport translations from '../../translations';\nconst { getDeleteMessage } = translations;\n\nexport default class MetaTags extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n tagInput: '',\n pageTags: props.fieldValue || [],\n autoSuggest: false,\n };\n }\n\n componentWillReceiveProps(nextProps) {\n const { fieldValue } = nextProps;\n this.setState({ pageTags: fieldValue || [] });\n }\n\n componentDidUpdate() {\n const { nameAttr, updateFieldValue } = this.props;\n updateFieldValue(nameAttr, this.state.pageTags);\n }\n\n createTag(value) {\n const { pageTags } = this.state;\n const clone = [...pageTags];\n\n // create tags only if they do not exist already\n if (!clone.includes(value)) {\n clone.push(value);\n\n this.setState(state => {\n return {\n pageTags: clone,\n tagInput: '',\n autoSuggest: false,\n };\n });\n }\n }\n\n deleteTag(index) {\n const { pageTags } = this.state;\n const clone = [...pageTags];\n\n const tagName = index === -1 ? clone.slice(-1).pop() : clone[index];\n const confirm = window.confirm(getDeleteMessage(`tag: ${tagName}`));\n\n if (confirm) {\n clone.splice(index, 1);\n this.setState({ pageTags: clone });\n this.refs.taginput.focus();\n }\n }\n\n // keys that when pressed and released creates a new tag from the input value.\n creators = [',', ' ', 'Enter'];\n\n handleKeyUp = e => {\n const { pageTags } = this.state;\n const input = e.target.value;\n\n if (input.length && this.creators.includes(e.key)) {\n this.createTag(input);\n } else if (pageTags.length && input.length === 0 && e.key === 'Backspace') {\n this.deleteTag(-1);\n }\n };\n\n handleOnChange = e => {\n const value = e.target.value;\n this.setState(state => {\n return { tagInput: value };\n });\n };\n\n showSuggestions = () => {\n this.setState(state => {\n return { autoSuggest: true };\n });\n };\n\n closeSuggestions = () => {\n this.setState(state => {\n return { autoSuggest: false };\n });\n };\n\n rectifyTag = tag => {\n const rectified = tag.toString().split(' ');\n this.setState(state => {\n return { pageTags: rectified };\n });\n };\n\n render() {\n const { pageTags } = this.state;\n const tagInput = `${this.state.tagInput}`;\n\n const suggestions = this.props.suggestions.filter(entry => {\n return entry.startsWith(tagInput);\n });\n\n if (!(pageTags instanceof Array)) {\n return (\n <span className=\"meta-error\">\n Expected an array of items. Found: <strong>{pageTags}</strong>\n <br />\n <span onClick={() => this.rectifyTag(pageTags)}>Click here</span>\n to correct.\n </span>\n );\n }\n\n const tagPool = pageTags.filter(Boolean); // filter out nil or empty elements\n const tags = tagPool.map((tag, i) => {\n return (\n <span key={i} className=\"tag\">\n {tag}\n <span className=\"delete-tag\" onClick={() => this.deleteTag(i)} />\n </span>\n );\n });\n\n const suggests = suggestions.map((item, i) => {\n if (!pageTags.includes(item)) {\n return (\n <li key={i} onClick={() => this.createTag(item)}>\n {item}\n </li>\n );\n }\n return null;\n }).filter(Boolean);\n\n const suggestionClasses = classnames('tag-suggestions', {\n visible: this.state.autoSuggest,\n });\n\n return (\n <div className=\"tags-wrap field value-field\">\n {tags.length > 0 && <div className=\"tags-list\">{tags}</div>}\n\n <div className=\"tags-input\">\n <input\n type=\"text\"\n onChange={this.handleOnChange}\n onFocus={this.showSuggestions}\n onKeyUp={this.handleKeyUp}\n value={tagInput.replace(/,|\\s+/, '')}\n ref=\"taginput\"\n />\n\n <TextareaAutosize\n className=\"field value-field\"\n value={this.state.pageTags.toString()}\n hidden\n />\n </div>\n {suggests.length > 0 && (\n <div className={suggestionClasses}>\n <ul>{suggests}</ul>\n <div className=\"close-suggestions\" onClick={this.closeSuggestions}>\n Close suggestions\n </div>\n </div>\n )}\n </div>\n );\n }\n}\n\nMetaTags.defaultProps = {\n fieldValue: [],\n suggestions: [],\n};\n\nMetaTags.propTypes = {\n updateFieldValue: PropTypes.func.isRequired,\n nameAttr: PropTypes.any.isRequired,\n suggestions: PropTypes.array,\n fieldValue: PropTypes.any,\n};\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport TextareaAutosize from 'react-textarea-autosize';\nimport DateTimePicker from 'react-widgets/lib/DateTimePicker';\nimport DropdownList from 'react-widgets/lib/DropdownList';\nimport moment from 'moment';\nimport momentLocalizer from 'react-widgets-moment';\nimport FilePicker from '../FilePicker';\nimport MetaTags from './MetaTags';\nimport 'react-widgets/dist/css/react-widgets.css';\n\nmomentLocalizer(moment);\n\nexport class MetaSimple extends Component {\n handleEditableChange = e => {\n const { nameAttr, updateFieldValue } = this.props;\n updateFieldValue(nameAttr, e.target.value);\n };\n\n handleDatepickerChange = (date, dateStr) => {\n const { nameAttr, updateFieldValue } = this.props;\n let formatted = moment(date).format('YYYY-MM-DD HH:mm:ss');\n updateFieldValue(nameAttr, formatted);\n };\n\n handleEditableBlur = e => {\n const { nameAttr, updateFieldValue } = this.props;\n updateFieldValue(nameAttr, e.target.value.trim());\n };\n\n renderEditable() {\n const { fieldValue } = this.props;\n return (\n <TextareaAutosize\n onChange={this.handleEditableChange}\n onBlur={this.handleEditableBlur}\n className=\"field value-field\"\n value={`${fieldValue}`}\n />\n );\n }\n\n renderDatepicker() {\n const { fieldValue } = this.props;\n let dateValue = new Date(fieldValue);\n if (`${dateValue}` === 'Invalid Date') dateValue = null;\n return (\n <DateTimePicker\n onChange={this.handleDatepickerChange}\n className=\"date-field\"\n value={dateValue}\n />\n );\n }\n\n onPickItem = path => {\n const { nameAttr, updateFieldValue } = this.props;\n this.refs.imagepicker.value = path;\n updateFieldValue(nameAttr, path);\n };\n\n renderStaticFilePicker() {\n const { fieldValue } = this.props;\n return (\n <div className=\"imagepicker\">\n <TextareaAutosize\n onChange={this.handleEditableChange}\n className=\"field value-field\"\n value={fieldValue}\n ref=\"imagepicker\"\n />\n <FilePicker onPick={this.onPickItem} />\n </div>\n );\n }\n\n handleLayoutChange = value => {\n const { nameAttr, updateFieldValue } = this.props;\n updateFieldValue(nameAttr, value);\n };\n\n renderLayoutPicker() {\n const { fieldValue, siteMeta } = this.props;\n\n if (!siteMeta) return this.renderEditable();\n const layouts = siteMeta.layouts || [];\n\n return (\n <DropdownList\n className=\"layout-field\"\n data={['none', ...layouts]}\n defaultValue={fieldValue}\n onChange={this.handleLayoutChange}\n />\n );\n }\n\n renderTagsInput(key) {\n const { fieldValue, nameAttr, updateFieldValue, siteMeta } = this.props;\n const suggestions = (siteMeta && siteMeta[key]) || [];\n\n return (\n <MetaTags\n fieldValue={fieldValue}\n nameAttr={nameAttr}\n updateFieldValue={updateFieldValue}\n suggestions={suggestions}\n />\n );\n }\n\n render() {\n const { fieldKey, nameAttr } = this.props;\n\n let node;\n switch (fieldKey) {\n case 'date':\n node = this.renderDatepicker();\n break;\n case 'image':\n case 'file':\n node = this.renderStaticFilePicker();\n break;\n case 'tags':\n case 'categories':\n node = this.renderTagsInput(fieldKey);\n break;\n default:\n node = this.renderEditable();\n }\n\n if (nameAttr === \"metadata['layout']\") {\n node = this.renderLayoutPicker();\n }\n\n return <div className=\"meta-value\">{node}</div>;\n }\n}\n\nMetaSimple.propTypes = {\n parentType: PropTypes.string.isRequired,\n fieldKey: PropTypes.string.isRequired,\n fieldValue: PropTypes.any,\n updateFieldValue: PropTypes.func.isRequired,\n nameAttr: PropTypes.any.isRequired,\n siteMeta: PropTypes.object,\n};\n\nexport default MetaSimple;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport Icon from '../Icon';\n\nexport default class MetaButtons extends Component {\n state = {\n dropdown: false,\n };\n\n fieldTypes = {\n simple: {\n icon: 'pencil',\n label: 'Simple',\n },\n array: {\n icon: 'list-ol',\n label: 'List',\n },\n object: {\n icon: 'th-large',\n label: 'Object',\n },\n };\n\n fieldTypeKeys = Object.keys(this.fieldTypes);\n\n toggleDropdownState = () => {\n this.setState(state => {\n return { dropdown: !state.dropdown };\n });\n };\n\n renderDropdownItems(type) {\n const { onConvertClick, parentKey } = this.props;\n\n if (parentKey === 'tags') return null;\n\n return this.fieldTypeKeys.map((ftype, i) => {\n if (type !== ftype) {\n const { icon, label } = this.fieldTypes[ftype];\n return (\n <span key={i} onMouseDown={() => onConvertClick(ftype)}>\n <Icon name={icon} />\n Convert to {label}\n </span>\n );\n }\n\n return null;\n }).filter(Boolean);\n }\n\n render() {\n const { currentType, parentType, onRemoveClick } = this.props;\n const sortableHandle = (\n <span className=\"move\">\n <Icon name=\"arrows\" />\n </span>\n );\n\n const dropdownClasses = classnames('dropdown', {\n 'showing-dropdown': this.state.dropdown,\n });\n\n return (\n <div className=\"meta-buttons\">\n {parentType === 'array' && sortableHandle}\n <span className={dropdownClasses}>\n <a\n className=\"meta-button\"\n tabIndex=\"1\"\n onClick={this.toggleDropdownState}\n onBlur={() => this.setState({ dropdown: false })}\n >\n <Icon name=\"chevron-down\" />\n </a>\n <div className=\"dropdown-wrap\">\n {this.renderDropdownItems(currentType)}\n <span onMouseDown={() => onRemoveClick()} className=\"remove-field\">\n <Icon name=\"trash-o\" />\n Remove field\n </span>\n </div>\n </span>\n </div>\n );\n }\n}\n\nMetaButtons.propTypes = {\n currentType: PropTypes.string.isRequired,\n parentType: PropTypes.string.isRequired,\n onConvertClick: PropTypes.func.isRequired,\n onRemoveClick: PropTypes.func.isRequired,\n parentKey: PropTypes.string,\n};\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { findDOMNode } from 'react-dom';\nimport MetaArray from './MetaArray';\nimport MetaObject from './MetaObject';\nimport MetaSimple from './MetaSimple';\nimport MetaButtons from './MetaButtons';\n\nexport class MetaObjectItem extends Component {\n handleConvertClick(type) {\n const { convertField, nameAttr } = this.props;\n convertField(nameAttr, type);\n }\n\n handleKeyBlur() {\n const { namePrefix, fieldKey, updateFieldKey } = this.props;\n let currentValue = findDOMNode(this.refs.field_key).value;\n if (fieldKey !== currentValue && currentValue !== '') {\n updateFieldKey(namePrefix, fieldKey, currentValue);\n }\n }\n\n handleRemoveClick() {\n const { removeField, namePrefix, fieldKey } = this.props;\n removeField(namePrefix, fieldKey);\n }\n\n render() {\n const {\n type,\n fieldKey,\n fieldValue,\n nameAttr,\n addField,\n removeField,\n updateFieldKey,\n updateFieldValue,\n convertField,\n key_prefix,\n moveArrayItem,\n } = this.props;\n const FieldTypes = {\n array: MetaArray,\n object: MetaObject,\n simple: MetaSimple,\n };\n const CurrentComponent = FieldTypes[type];\n return (\n <div ref=\"wrap\" className=\"object-item-wrap\">\n <div className={`object-key ${type}`}>\n <input\n ref=\"field_key\"\n onBlur={e => this.handleKeyBlur(e)}\n defaultValue={fieldKey}\n className=\"field key-field\"\n type=\"text\"\n placeholder=\"Key\"\n />\n <MetaButtons\n currentType={type}\n parentType=\"object\"\n onConvertClick={type => this.handleConvertClick(type)}\n onRemoveClick={() => this.handleRemoveClick()}\n />\n </div>\n <div className=\"object-value\">\n <CurrentComponent\n key_prefix={key_prefix}\n parentType=\"object\"\n fieldKey={fieldKey}\n fieldValue={fieldValue}\n addField={addField}\n removeField={removeField}\n updateFieldKey={updateFieldKey}\n updateFieldValue={updateFieldValue}\n moveArrayItem={moveArrayItem}\n convertField={convertField}\n nameAttr={nameAttr}\n namePrefix={nameAttr}\n />\n </div>\n </div>\n );\n }\n}\n\nMetaObjectItem.propTypes = {\n type: PropTypes.string.isRequired,\n fieldKey: PropTypes.string.isRequired,\n fieldValue: PropTypes.any.isRequired,\n nameAttr: PropTypes.string.isRequired,\n namePrefix: PropTypes.string.isRequired,\n addField: PropTypes.func.isRequired,\n removeField: PropTypes.func.isRequired,\n convertField: PropTypes.func.isRequired,\n updateFieldKey: PropTypes.func.isRequired,\n updateFieldValue: PropTypes.func.isRequired,\n moveArrayItem: PropTypes.func.isRequired,\n key_prefix: PropTypes.string.isRequired,\n};\nexport default MetaObjectItem;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport _ from 'underscore';\nimport MetaObjectItem from './MetaObjectItem';\nimport { computeFieldType } from '../../utils/metadata';\n\nexport class MetaObject extends Component {\n render() {\n const {\n fieldKey,\n fieldValue,\n namePrefix,\n addField,\n removeField,\n updateFieldKey,\n updateFieldValue,\n convertField,\n key_prefix,\n moveArrayItem,\n } = this.props;\n const items = _.map(fieldValue, (value, key) => {\n const type = computeFieldType(value, key);\n return (\n <MetaObjectItem\n key={key}\n key_prefix={key_prefix}\n fieldKey={key}\n fieldValue={value}\n type={type}\n addField={addField}\n removeField={removeField}\n updateFieldKey={updateFieldKey}\n updateFieldValue={updateFieldValue}\n moveArrayItem={moveArrayItem}\n convertField={convertField}\n nameAttr={`${namePrefix}['${key}']`}\n namePrefix={namePrefix}\n />\n );\n });\n return (\n <div className=\"meta-value-object\">\n {items}\n <a\n onClick={() => addField(namePrefix)}\n className=\"add-field-object\"\n title=\"Add new key/value pair\"\n >\n New key/value pair under <strong>{fieldKey}</strong>\n </a>\n </div>\n );\n }\n}\n\nMetaObject.propTypes = {\n fieldKey: PropTypes.string.isRequired,\n fieldValue: PropTypes.any.isRequired,\n nameAttr: PropTypes.string.isRequired,\n namePrefix: PropTypes.string.isRequired,\n addField: PropTypes.func.isRequired,\n removeField: PropTypes.func.isRequired,\n convertField: PropTypes.func.isRequired,\n updateFieldKey: PropTypes.func.isRequired,\n updateFieldValue: PropTypes.func.isRequired,\n moveArrayItem: PropTypes.func.isRequired,\n key_prefix: PropTypes.string.isRequired,\n};\n\nexport default MetaObject;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport MetaArray from './MetaArray';\nimport MetaObject from './MetaObject';\nimport MetaSimple from './MetaSimple';\nimport MetaButtons from './MetaButtons';\n\nexport class MetaArrayItem extends Component {\n handleConvertClick(type) {\n const { convertField, nameAttr } = this.props;\n convertField(nameAttr, type);\n }\n\n handleRemoveClick() {\n const { removeField, namePrefix, index } = this.props;\n removeField(namePrefix, index);\n }\n\n render() {\n const {\n type,\n fieldKey,\n fieldValue,\n index,\n nameAttr,\n addField,\n removeField,\n updateFieldKey,\n updateFieldValue,\n moveArrayItem,\n convertField,\n key_prefix,\n } = this.props;\n const FieldTypes = {\n array: MetaArray,\n object: MetaObject,\n simple: MetaSimple,\n };\n const CurrentComponent = FieldTypes[type];\n return (\n <div ref=\"wrap\" data-id={index} className=\"array-item-wrap\">\n <div className=\"array\">\n <div className=\"array-header\">\n <span className=\"array-field-num\">{index + 1}.</span>\n <MetaButtons\n currentType={type}\n parentType=\"array\"\n onConvertClick={type => this.handleConvertClick(type)}\n onRemoveClick={() => this.handleRemoveClick()}\n />\n </div>\n <CurrentComponent\n key_prefix={key_prefix}\n parentType=\"array\"\n fieldKey={fieldKey}\n fieldValue={fieldValue}\n addField={addField}\n removeField={removeField}\n updateFieldKey={updateFieldKey}\n updateFieldValue={updateFieldValue}\n moveArrayItem={moveArrayItem}\n convertField={convertField}\n nameAttr={nameAttr}\n namePrefix={nameAttr}\n />\n </div>\n </div>\n );\n }\n}\n\nMetaArrayItem.propTypes = {\n type: PropTypes.string.isRequired,\n index: PropTypes.number.isRequired,\n fieldKey: PropTypes.string.isRequired,\n fieldValue: PropTypes.any.isRequired,\n addField: PropTypes.func.isRequired,\n removeField: PropTypes.func.isRequired,\n updateFieldKey: PropTypes.func.isRequired,\n updateFieldValue: PropTypes.func.isRequired,\n moveArrayItem: PropTypes.func.isRequired,\n convertField: PropTypes.func.isRequired,\n nameAttr: PropTypes.string.isRequired,\n namePrefix: PropTypes.string.isRequired,\n key_prefix: PropTypes.string.isRequired,\n};\n\nexport default MetaArrayItem;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport Sortable from 'sortablejs';\nimport Icon from '../Icon';\nimport MetaArrayItem from './MetaArrayItem';\nimport { computeFieldType } from '../../utils/metadata';\n\nexport class MetaArray extends Component {\n sortableGroupDecorator(component) {\n const { moveArrayItem, namePrefix } = this.props;\n if (component) {\n const options = {\n draggable: '.array-item-wrap',\n group: { name: 'meta-array-items', pull: false, put: false },\n handle: '.move',\n animation: 0,\n onEnd: e => {\n let srcInd = e.item.getAttribute('data-id');\n moveArrayItem(namePrefix, srcInd, e.newIndex);\n },\n };\n Sortable.create(component, options);\n }\n }\n\n render() {\n const {\n fieldKey,\n fieldValue,\n namePrefix,\n addField,\n removeField,\n updateFieldKey,\n updateFieldValue,\n moveArrayItem,\n convertField,\n key_prefix,\n } = this.props;\n const items = fieldValue.map((item, i) => {\n const type = computeFieldType(item);\n return (\n <MetaArrayItem\n key={`${key_prefix}-${i}`}\n key_prefix={key_prefix}\n index={i}\n fieldKey={fieldKey}\n fieldValue={item}\n type={type}\n addField={addField}\n removeField={removeField}\n updateFieldKey={updateFieldKey}\n updateFieldValue={updateFieldValue}\n moveArrayItem={moveArrayItem}\n convertField={convertField}\n nameAttr={`${namePrefix}[${i}]`}\n namePrefix={namePrefix}\n />\n );\n });\n return (\n <div\n className=\"meta-value-array\"\n ref={this.sortableGroupDecorator.bind(this)}\n >\n {items}\n <a\n onClick={() => addField(namePrefix)}\n className=\"add-field-array\"\n title=\"Add new list item\"\n >\n <Icon name=\"plus\" />\n </a>\n </div>\n );\n }\n}\n\nMetaArray.propTypes = {\n fieldKey: PropTypes.string.isRequired,\n fieldValue: PropTypes.any.isRequired,\n nameAttr: PropTypes.string.isRequired,\n namePrefix: PropTypes.string.isRequired,\n addField: PropTypes.func.isRequired,\n removeField: PropTypes.func.isRequired,\n updateFieldKey: PropTypes.func.isRequired,\n updateFieldValue: PropTypes.func.isRequired,\n convertField: PropTypes.func.isRequired,\n moveArrayItem: PropTypes.func.isRequired,\n key_prefix: PropTypes.string.isRequired,\n};\n\nexport default MetaArray;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { findDOMNode } from 'react-dom';\nimport MetaArray from './MetaArray';\nimport MetaObject from './MetaObject';\nimport MetaSimple from './MetaSimple';\nimport MetaButtons from './MetaButtons';\n\nexport class MetaField extends Component {\n componentDidMount() {\n const isNewField = /New field/.test(this.props.fieldKey);\n isNewField && this.refs.field_key.select();\n }\n\n handleConvertClick(type) {\n const { convertField, nameAttr } = this.props;\n convertField(nameAttr, type);\n }\n\n handleKeyBlur() {\n const { namePrefix, fieldKey, updateFieldKey } = this.props;\n let currentValue = findDOMNode(this.refs.field_key).value;\n if (fieldKey !== currentValue && currentValue !== '') {\n updateFieldKey(namePrefix, fieldKey, currentValue);\n }\n }\n\n handleRemoveClick() {\n const { removeField, namePrefix, fieldKey } = this.props;\n removeField(namePrefix, fieldKey);\n }\n\n render() {\n const {\n type,\n parentType,\n fieldKey,\n fieldValue,\n namePrefix,\n addField,\n removeField,\n updateFieldKey,\n updateFieldValue,\n moveArrayItem,\n convertField,\n key_prefix,\n siteMeta,\n } = this.props;\n\n const FieldTypes = {\n array: MetaArray,\n object: MetaObject,\n simple: MetaSimple,\n };\n const CurrentComponent = FieldTypes[type];\n return (\n <div ref=\"wrap\" className=\"metafield\">\n <div className={`meta-key ${type}`}>\n <input\n ref=\"field_key\"\n onBlur={() => this.handleKeyBlur()}\n defaultValue={fieldKey}\n className=\"field key-field\"\n type=\"text\"\n placeholder=\"Key\"\n />\n <MetaButtons\n currentType={type}\n parentType=\"top\"\n parentKey={fieldKey}\n onConvertClick={type => this.handleConvertClick(type)}\n onRemoveClick={() => this.handleRemoveClick()}\n />\n </div>\n <CurrentComponent\n key_prefix={key_prefix}\n fieldKey={fieldKey}\n parentType={parentType}\n fieldValue={fieldValue}\n addField={addField}\n removeField={removeField}\n updateFieldKey={updateFieldKey}\n updateFieldValue={updateFieldValue}\n moveArrayItem={moveArrayItem}\n convertField={convertField}\n nameAttr={`${namePrefix}['${fieldKey}']`}\n namePrefix={`${namePrefix}['${fieldKey}']`}\n siteMeta={siteMeta}\n />\n </div>\n );\n }\n}\n\nMetaField.propTypes = {\n type: PropTypes.string.isRequired,\n parentType: PropTypes.string.isRequired,\n addField: PropTypes.func.isRequired,\n removeField: PropTypes.func.isRequired,\n updateFieldKey: PropTypes.func.isRequired,\n updateFieldValue: PropTypes.func.isRequired,\n moveArrayItem: PropTypes.func.isRequired,\n convertField: PropTypes.func.isRequired,\n fieldKey: PropTypes.string.isRequired,\n fieldValue: PropTypes.any,\n nameAttr: PropTypes.string.isRequired,\n namePrefix: PropTypes.string.isRequired,\n key_prefix: PropTypes.string.isRequired,\n siteMeta: PropTypes.object,\n};\n\nexport default MetaField;\n","import {\n addFieldToMetadata,\n removeFieldFromMetadata,\n updateMetadataFieldKey,\n updateMetadataFieldValue,\n moveMetadataArrayItem,\n convertMetadataField,\n} from '../utils/metadata';\n\n// Action Types\nexport const UPDATE_TITLE = 'UPDATE_TITLE';\nexport const UPDATE_BODY = 'UPDATE_BODY';\nexport const UPDATE_PATH = 'UPDATE_PATH';\nexport const STORE_CONTENT_FIELDS = 'STORE_CONTENT_FIELDS';\nexport const ADD_METAFIELD = 'ADD_METAFIELD';\nexport const REMOVE_METAFIELD = 'REMOVE_METAFIELD';\nexport const UPDATE_FIELD_KEY = 'UPDATE_FIELD_KEY';\nexport const UPDATE_FIELD_VALUE = 'UPDATE_FIELD_VALUE';\nexport const MOVE_ARRAY_ITEM = 'MOVE_ARRAY_ITEM';\nexport const CONVERT_FIELD = 'CONVERT_FIELD';\n\n// Actions\nexport const storeContentFields = content => ({\n type: STORE_CONTENT_FIELDS,\n content,\n});\n\nexport const addField = namePrefix => ({\n type: ADD_METAFIELD,\n namePrefix,\n});\n\nexport const removeField = (namePrefix, key) => ({\n type: REMOVE_METAFIELD,\n namePrefix,\n key,\n});\n\nexport const updateFieldKey = (namePrefix, fieldKey, newKey) => ({\n type: UPDATE_FIELD_KEY,\n namePrefix,\n fieldKey,\n newKey,\n});\n\nexport const updateFieldValue = (nameAttr, value) => ({\n type: UPDATE_FIELD_VALUE,\n nameAttr,\n value,\n});\n\nexport const moveArrayItem = (namePrefix, srcInd, targetInd) => ({\n type: MOVE_ARRAY_ITEM,\n namePrefix,\n srcInd,\n targetInd,\n});\n\nexport const convertField = (nameAttr, convertType) => ({\n type: CONVERT_FIELD,\n nameAttr,\n convertType,\n});\n\nexport const updateTitle = title => ({\n type: UPDATE_TITLE,\n title,\n});\n\nexport const updateBody = body => ({\n type: UPDATE_BODY,\n body,\n});\n\nexport const updatePath = path => ({\n type: UPDATE_PATH,\n path,\n});\n\n// Reducer\nexport default function metadata( // TODO normalize the metadata\n state = {\n metadata: {},\n new_field_count: 1,\n key_prefix: '', // force children to be rerendered on sort\n fieldChanged: false,\n },\n action\n) {\n switch (action.type) {\n case UPDATE_TITLE:\n return {\n ...state,\n metadata: {\n ...state.metadata,\n title: action.title,\n },\n fieldChanged: true,\n };\n case UPDATE_BODY:\n return {\n ...state,\n metadata: {\n ...state.metadata,\n raw_content: action.body,\n },\n fieldChanged: true,\n };\n case UPDATE_PATH:\n return {\n ...state,\n metadata: {\n ...state.metadata,\n path: action.path,\n },\n fieldChanged: true,\n };\n case STORE_CONTENT_FIELDS:\n return {\n ...state,\n metadata: action.content,\n };\n case ADD_METAFIELD:\n return {\n ...state,\n metadata: addFieldToMetadata(state, action.namePrefix),\n new_field_count: state.new_field_count + 1,\n };\n case REMOVE_METAFIELD:\n return {\n ...state,\n metadata: removeFieldFromMetadata(state, action.namePrefix, action.key),\n fieldChanged: true,\n key_prefix: `${Math.random() * 100}`,\n };\n case UPDATE_FIELD_KEY:\n return {\n ...state,\n metadata: updateMetadataFieldKey(\n state,\n action.namePrefix,\n action.fieldKey,\n action.newKey.trim()\n ),\n fieldChanged: true,\n };\n case UPDATE_FIELD_VALUE:\n return {\n ...state,\n metadata: updateMetadataFieldValue(\n state,\n action.nameAttr,\n action.value\n ),\n fieldChanged: true,\n };\n case MOVE_ARRAY_ITEM:\n return {\n ...state,\n metadata: moveMetadataArrayItem(\n state,\n action.namePrefix,\n action.srcInd,\n action.targetInd\n ),\n key_prefix: `${Math.random() * 100}`,\n fieldChanged: true,\n };\n case CONVERT_FIELD:\n return {\n ...state,\n metadata: convertMetadataField(\n state,\n action.nameAttr,\n action.convertType\n ),\n new_field_count: state.new_field_count + 1,\n fieldChanged: true,\n };\n default:\n return {\n ...state,\n fieldChanged: false,\n };\n }\n}\n","import { getSiteMetaUrl } from '../constants/api';\nimport { get } from '../utils/fetch';\n\n// Action Types\nexport const FETCH_SITE_META_REQUEST = 'FETCH_SITE_META_REQUEST';\nexport const FETCH_SITE_META_SUCCESS = 'FETCH_SITE_META_SUCCESS';\nexport const FETCH_SITE_META_FAILURE = 'FETCH_SITE_META_FAILURE';\n\n// Actions\nexport const fetchSiteMeta = () => dispatch => {\n dispatch({ type: FETCH_SITE_META_REQUEST });\n return get(\n getSiteMetaUrl(),\n { type: FETCH_SITE_META_SUCCESS, name: 'site' },\n { type: FETCH_SITE_META_FAILURE, name: 'error' },\n dispatch\n );\n};\n\n// Reducer\nexport default function siteMeta(\n state = {\n site: {},\n isFetching: false,\n },\n action\n) {\n switch (action.type) {\n case FETCH_SITE_META_REQUEST:\n return {\n ...state,\n isFetching: true,\n };\n case FETCH_SITE_META_SUCCESS:\n return {\n ...state,\n site: action.site,\n isFetching: false,\n };\n case FETCH_SITE_META_FAILURE:\n return {\n ...state,\n isFetching: false,\n };\n default:\n return state;\n }\n}\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport _ from 'underscore';\nimport MetaField from '../components/metadata/MetaField';\nimport Icon from '../components/Icon';\nimport {\n storeContentFields,\n addField,\n removeField,\n updateFieldKey,\n updateFieldValue,\n moveArrayItem,\n convertField,\n} from '../ducks/metadata';\nimport { fetchSiteMeta } from '../ducks/siteMeta';\nimport { computeFieldType } from '../utils/metadata';\n\nexport class MetaFields extends Component {\n componentDidMount() {\n const { storeContentFields, fields, fetchSiteMeta, dataview } = this.props;\n if (!dataview) fetchSiteMeta();\n storeContentFields(fields);\n }\n\n shouldComponentUpdate(nextProps) {\n return !_.isEqual(nextProps.metadata, this.props.metadata);\n }\n\n render() {\n const {\n metadata,\n addField,\n removeField,\n updateFieldKey,\n updateFieldValue,\n moveArrayItem,\n convertField,\n key_prefix,\n dataview,\n site,\n } = this.props;\n\n let visibleKeys = metadata;\n\n if (!dataview) {\n visibleKeys = _.omit(visibleKeys, ['title', 'path', 'raw_content']);\n }\n\n const metafieldsClass = classnames({\n datafields: dataview,\n metafields: !dataview,\n });\n\n const metafields = _.map(visibleKeys, (field, key) => {\n const type = computeFieldType(field, key);\n return (\n <MetaField\n key={key}\n key_prefix={key_prefix}\n type={type}\n parentType=\"top\"\n fieldKey={key}\n fieldValue={field}\n addField={addField}\n removeField={removeField}\n updateFieldKey={updateFieldKey}\n updateFieldValue={updateFieldValue}\n moveArrayItem={moveArrayItem}\n convertField={convertField}\n nameAttr={`metadata['${key}']`}\n namePrefix={`metadata`}\n siteMeta={dataview ? null : site}\n />\n );\n });\n\n const newWrapper = dataview ? (\n <div className=\"data-new\">\n <a onClick={() => addField('metadata')}>\n <Icon name=\"plus-circle\" /> New data field\n </a>\n </div>\n ) : (\n <div className=\"meta-new\">\n <a onClick={() => addField('metadata')} className=\"tooltip\">\n <Icon name=\"plus-circle\" /> New metadata field\n <span className=\"tooltip-text\">\n Metadata will be stored as the <b>YAML front matter</b> within the\n document.\n </span>\n </a>\n <small className=\"tooltip pull-right\">\n <Icon name=\"info-circle\" />\n Special Keys\n <span className=\"tooltip-text\">\n You can use special keys like <b>date</b>, <b>file</b>, <b>image</b>\n , <b>layout</b> or <b>tags</b> for user-friendly functionalities.\n </span>\n </small>\n </div>\n );\n\n return (\n <div className={metafieldsClass}>\n {metafields}\n {newWrapper}\n </div>\n );\n }\n}\n\nMetaFields.propTypes = {\n fields: PropTypes.object.isRequired,\n metadata: PropTypes.object.isRequired,\n key_prefix: PropTypes.string.isRequired,\n storeContentFields: PropTypes.func.isRequired,\n addField: PropTypes.func.isRequired,\n removeField: PropTypes.func.isRequired,\n updateFieldKey: PropTypes.func.isRequired,\n updateFieldValue: PropTypes.func.isRequired,\n moveArrayItem: PropTypes.func.isRequired,\n convertField: PropTypes.func.isRequired,\n fetchSiteMeta: PropTypes.func.isRequired,\n dataview: PropTypes.bool,\n site: PropTypes.object,\n};\n\nconst mapStateToProps = state => ({\n metadata: state.metadata.metadata,\n key_prefix: state.metadata.key_prefix,\n site: state.meta.site,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n storeContentFields,\n fetchSiteMeta,\n addField,\n removeField,\n updateFieldKey,\n updateFieldValue,\n moveArrayItem,\n convertField,\n },\n dispatch\n );\n\nexport default connect(mapStateToProps, mapDispatchToProps)(MetaFields);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport MetaFields from '../containers/MetaFields';\n\nclass DataGUI extends Component {\n handleChange = e => this.props.onChange(e.target.value);\n\n renderPathFields(slug, ext) {\n return (\n <form className=\"datafile-path\">\n <fieldset className=\"filename\">\n <legend>Path (without extension)</legend>\n <input\n type=\"text\"\n id=\"path\"\n defaultValue={slug}\n placeholder=\"filename\"\n onChange={this.handleChange}\n ref=\"filepath\"\n />\n </fieldset>\n <fieldset className=\"file-type\">\n <legend>File Type</legend>\n <select\n id=\"extn\"\n defaultValue={ext}\n onChange={this.handleChange}\n ref=\"extname\"\n >\n <option value=\".yml\">YAML</option>\n <option value=\".json\">JSON</option>\n </select>\n </fieldset>\n </form>\n );\n }\n\n render() {\n const { fields, slug, ext, restricted } = this.props;\n return (\n <div>\n <div className=\"warning\">\n CAUTION! Any existing comments will be lost when editing via this\n view. Switch to the <strong>Raw Editor</strong> to preserve them.\n </div>\n {!restricted && this.renderPathFields(slug, ext)}\n <MetaFields fields={fields} dataview />\n </div>\n );\n }\n}\n\nDataGUI.defaultProps = {\n fields: {},\n slug: '',\n ext: '',\n restricted: false,\n};\n\nDataGUI.propTypes = {\n onChange: PropTypes.func.isRequired,\n fields: PropTypes.object,\n slug: PropTypes.string,\n ext: PropTypes.string,\n restricted: PropTypes.bool,\n};\n\nexport default DataGUI;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport AceEditor from 'react-ace';\nimport 'brace/mode/json';\nimport 'brace/mode/yaml';\nimport 'brace/theme/monokai';\n\nclass Editor extends Component {\n shouldComponentUpdate(nextProps, nextState) {\n return nextProps.content !== this.props.content;\n }\n\n handleChange = () => {\n const { onEditorChange, editorChanged } = this.props;\n !editorChanged && onEditorChange();\n };\n\n getValue() {\n return this.refs.ace.editor.getValue();\n }\n\n render() {\n const { content, type } = this.props;\n const mode = /json/i.test(type) ? 'json' : 'yaml';\n return (\n <div>\n <AceEditor\n value={content}\n mode={mode}\n theme=\"monokai\"\n width=\"100%\"\n height=\"400px\"\n showGutter={false}\n showPrintMargin={false}\n highlightActiveLine={false}\n className=\"config-editor\"\n fontSize={14}\n scrollMargin={[15, 15, 15, 15]}\n ref=\"ace\"\n onChange={this.handleChange}\n />\n <div className=\"statusbar\">mode: {mode.toUpperCase()}</div>\n </div>\n );\n }\n}\n\nEditor.propTypes = {\n content: PropTypes.any.isRequired,\n onEditorChange: PropTypes.func.isRequired,\n editorChanged: PropTypes.bool.isRequired,\n type: PropTypes.string,\n};\n\nexport default Editor;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport _ from 'underscore';\n\nconst Errors = ({ errors }) => (\n <div className=\"error-messages\">\n {_.map(errors, (error, i) => <div key={i}>{error}</div>)}\n </div>\n);\n\nErrors.propTypes = {\n errors: PropTypes.array.isRequired,\n};\n\nexport default Errors;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport classnames from 'classnames';\nimport Icon from './Icon';\n\nimport translations from '../translations';\nconst { labels } = translations;\n\nconst iconMap = {\n create: 'plus-square',\n delete: 'trash',\n publish: 'send-o',\n save: 'save',\n upload: 'upload',\n view: 'eye',\n};\n\nexport default function Button({\n type,\n active,\n triggered,\n onClick,\n block,\n thin,\n icon,\n to,\n}) {\n const btnClass = classnames('btn', {\n 'btn-active': active,\n 'btn-success': active && (type === 'save' || type === 'create'),\n 'btn-delete': type === 'delete',\n 'btn-view': type === 'view' || type === 'publish',\n 'btn-inactive': !active,\n 'btn-fat': block,\n 'btn-thin': thin,\n });\n\n let label, triggeredLabel;\n switch (type) {\n case 'save':\n case 'create':\n label = labels[type].label;\n triggeredLabel = labels[type].triggeredLabel;\n break;\n case 'view-toggle':\n label = labels.viewToggle.label;\n triggeredLabel = labels.viewToggle.triggeredLabel;\n break;\n case 'view':\n case 'delete':\n case 'upload':\n case 'publish':\n label = labels[type].label;\n break;\n default:\n label = '<LABEL>';\n triggeredLabel = '<NEXT LABEL>';\n }\n\n const iconName = icon || iconMap[type];\n const iconNode = iconName && <Icon name={iconName} />;\n\n if (to) {\n return (\n <a href={to} target=\"_blank\" rel=\"noopener noreferrer\" className={btnClass}>\n {iconNode}\n {label}\n </a>\n );\n } else if (onClick) {\n return (\n <button onClick={onClick} className={btnClass}>\n {iconNode}\n {triggered ? triggeredLabel : label}\n </button>\n );\n }\n\n return null;\n}\n\nButton.propTypes = {\n type: PropTypes.string.isRequired,\n active: PropTypes.bool.isRequired,\n onClick: PropTypes.func,\n triggered: PropTypes.bool,\n block: PropTypes.bool,\n thin: PropTypes.bool,\n icon: PropTypes.string,\n to: PropTypes.string,\n};\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { withRouter } from 'react-router';\nimport { HotKeys } from 'react-hotkeys';\nimport DocumentTitle from 'react-document-title';\nimport DataGUI from '../../components/DataGUI';\nimport Editor from '../../components/Editor';\nimport Errors from '../../components/Errors';\nimport Button from '../../components/Button';\nimport { putConfig, onEditorChange } from '../../ducks/config';\nimport { clearErrors } from '../../ducks/utils';\nimport { preventDefault } from '../../utils/helpers';\n\nimport translations from '../../translations';\nconst { getLeaveMessage } = translations;\n\nexport class Configuration extends Component {\n state = {\n guiView: false,\n };\n\n componentDidMount() {\n const { router, route } = this.props;\n router.setRouteLeaveHook(route, this.routerWillLeave);\n }\n\n componentWillUnmount() {\n const { clearErrors, errors } = this.props;\n errors.length && clearErrors();\n }\n\n routerWillLeave = nextLocation => {\n const { editorChanged, fieldChanged } = this.props;\n if (editorChanged || fieldChanged) {\n return getLeaveMessage();\n }\n };\n\n toggleView = () => {\n this.setState(state => {\n return { guiView: !state.guiView };\n });\n };\n\n handleClickSave = e => {\n preventDefault(e);\n const { editorChanged, fieldChanged, putConfig } = this.props;\n if (editorChanged) {\n const value = this.refs.editor.getValue();\n putConfig(value);\n } else if (fieldChanged) {\n putConfig(null, 'gui');\n }\n };\n\n renderContentBody() {\n const { config, editorChanged, onEditorChange } = this.props;\n const { raw_content, content } = config;\n\n if (this.state.guiView && content) {\n return <DataGUI fields={content} onChange={onEditorChange} restricted />;\n }\n\n return (\n <Editor\n editorChanged={editorChanged}\n onEditorChange={onEditorChange}\n content={raw_content}\n ref=\"editor\"\n />\n );\n }\n\n render() {\n const { editorChanged, fieldChanged, updated, errors } = this.props;\n\n const keyboardHandlers = {\n save: this.handleClickSave,\n };\n\n return (\n <DocumentTitle title=\"Configuration\">\n <HotKeys handlers={keyboardHandlers} className=\"single\">\n {errors && errors.length > 0 && <Errors errors={errors} />}\n <div className=\"content-header\">\n <h1>Configuration</h1>\n <div className=\"page-buttons multiple\">\n <Button\n onClick={this.toggleView}\n type=\"view-toggle\"\n triggered={this.state.guiView}\n active\n block\n />\n <Button\n onClick={this.handleClickSave}\n type=\"save\"\n active={editorChanged || fieldChanged}\n triggered={updated}\n block\n />\n </div>\n </div>\n <div className=\"content-body\">{this.renderContentBody()}</div>\n </HotKeys>\n </DocumentTitle>\n );\n }\n}\n\nConfiguration.propTypes = {\n config: PropTypes.object.isRequired,\n onEditorChange: PropTypes.func.isRequired,\n putConfig: PropTypes.func.isRequired,\n updated: PropTypes.bool.isRequired,\n editorChanged: PropTypes.bool.isRequired,\n fieldChanged: PropTypes.bool.isRequired,\n errors: PropTypes.array.isRequired,\n clearErrors: PropTypes.func.isRequired,\n router: PropTypes.object.isRequired,\n route: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n config: state.config.config,\n updated: state.config.updated,\n editorChanged: state.config.editorChanged,\n fieldChanged: state.metadata.fieldChanged,\n errors: state.utils.errors,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators({ putConfig, onEditorChange, clearErrors }, dispatch);\n\nexport default withRouter(\n connect(mapStateToProps, mapDispatchToProps)(Configuration)\n);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { browserHistory, Link } from 'react-router';\nimport Breadcrumbs from './Breadcrumbs';\nimport Button from './Button';\nimport Icon from './Icon';\nimport InputSearch from './form/InputSearch';\nimport { ADMIN_PREFIX } from '../constants';\n\nimport translations from '../translations';\nconst { getDeleteMessage, getNotFoundMessage } = translations;\n\nexport default class Explorer extends Component {\n handleClickDelete(filename) {\n const { deleteItem, params, type } = this.props;\n const confirm = window.confirm(getDeleteMessage(filename));\n const dir = params.splat ? `/${params.splat}` : '';\n if (confirm) {\n deleteItem(params.splat, filename);\n browserHistory.push(`${ADMIN_PREFIX}/${type}${dir}`);\n }\n }\n\n renderTitleCell(name, icon, type, path) {\n return (\n <td className=\"row-title\">\n <strong>\n <Link to={`${ADMIN_PREFIX}/${type}/${path}`}>\n <Icon name={icon} />\n {name}\n </Link>\n </strong>\n </td>\n );\n }\n\n renderDirectoryRow(directory, type, index) {\n const { name, relative_path } = directory;\n return (\n <tr key={index}>\n {this.renderTitleCell(name, 'folder', type, relative_path)}\n <td />\n </tr>\n );\n }\n\n renderFileRow(file, type, index) {\n const { name, relative_path, http_url } = file;\n return (\n <tr key={index}>\n {this.renderTitleCell(name, 'file-text-o', type, relative_path)}\n <td>\n <div className=\"row-actions\">\n <Button\n onClick={() => this.handleClickDelete(name)}\n type=\"delete\"\n active\n thin\n />\n {http_url && <Button to={http_url} type=\"view\" active thin />}\n </div>\n </td>\n </tr>\n );\n }\n\n renderRows() {\n const { items, type } = this.props;\n return items.map((entry, index) =>\n entry.type === 'directory'\n ? this.renderDirectoryRow(entry, type, index)\n : this.renderFileRow(entry, type, index)\n );\n }\n\n render() {\n const { items, type, newBtnLabel, search, params } = this.props;\n const typeLabel = type === 'datafiles' ? 'data files' : type;\n\n const to = params.splat\n ? `${ADMIN_PREFIX}/${type}/${params.splat}/new`\n : `${ADMIN_PREFIX}/${type}/new`;\n\n const content = items.length ? (\n <div className=\"content-table\">\n <table>\n <thead>\n <tr>\n <th>Filename</th>\n <th className=\"th-actions\">Actions</th>\n </tr>\n </thead>\n <tbody>{this.renderRows()}</tbody>\n </table>\n </div>\n ) : (\n <h1>{getNotFoundMessage(typeLabel)}</h1>\n );\n\n return (\n <div>\n <div className=\"content-header\">\n <Breadcrumbs type={type} splat={params.splat} />\n <div className=\"page-buttons\">\n <Link className=\"btn btn-active\" to={to}>\n {newBtnLabel}\n </Link>\n </div>\n <div className=\"pull-right\">\n <InputSearch searchBy=\"filename\" search={search} />\n </div>\n </div>\n {content}\n </div>\n );\n }\n}\n\nExplorer.propTypes = {\n type: PropTypes.string.isRequired,\n items: PropTypes.array.isRequired,\n params: PropTypes.object.isRequired,\n newBtnLabel: PropTypes.string.isRequired,\n deleteItem: PropTypes.func.isRequired,\n search: PropTypes.func.isRequired,\n};\n","import _ from 'underscore';\nimport { CLEAR_ERRORS, validationError, filterDeleted } from './utils';\nimport { get, put, del } from '../utils/fetch';\nimport { validator } from '../utils/validation';\nimport { slugify, trimObject, computeRelativePath } from '../utils/helpers';\nimport { pagesAPIUrl, pageAPIUrl } from '../constants/api';\n\nimport translations from '../translations';\nconst { getTitleRequiredMessage, getFilenameNotValidMessage } = translations;\n\n// Action Types\nexport const FETCH_PAGES_REQUEST = 'FETCH_PAGES_REQUEST';\nexport const FETCH_PAGES_SUCCESS = 'FETCH_PAGES_SUCCESS';\nexport const FETCH_PAGES_FAILURE = 'FETCH_PAGES_FAILURE';\nexport const FETCH_PAGE_REQUEST = 'FETCH_PAGE_REQUEST';\nexport const FETCH_PAGE_SUCCESS = 'FETCH_PAGE_SUCCESS';\nexport const FETCH_PAGE_FAILURE = 'FETCH_PAGE_FAILURE';\nexport const PUT_PAGE_REQUEST = 'PUT_PAGE_REQUEST';\nexport const PUT_PAGE_SUCCESS = 'PUT_PAGE_SUCCESS';\nexport const PUT_PAGE_FAILURE = 'PUT_PAGE_FAILURE';\nexport const DELETE_PAGE_REQUEST = 'DELETE_PAGE_REQUEST';\nexport const DELETE_PAGE_SUCCESS = 'DELETE_PAGE_SUCCESS';\nexport const DELETE_PAGE_FAILURE = 'DELETE_PAGE_FAILURE';\n\n// Actions\nexport const fetchPages = (directory = '') => dispatch => {\n dispatch({ type: FETCH_PAGES_REQUEST });\n return get(\n pagesAPIUrl(directory),\n { type: FETCH_PAGES_SUCCESS, name: 'pages' },\n { type: FETCH_PAGES_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const fetchPage = (directory, filename) => dispatch => {\n dispatch({ type: FETCH_PAGE_REQUEST });\n return get(\n pageAPIUrl(directory, filename),\n { type: FETCH_PAGE_SUCCESS, name: 'page' },\n { type: FETCH_PAGE_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const createPage = directory => (dispatch, getState) => {\n // get edited fields from metadata state\n const metadata = getState().metadata.metadata;\n let { path, raw_content, title } = metadata;\n // if path is not given or equals to directory, generate filename from the title\n if (!path && title) {\n path = `${slugify(title)}.md`;\n } else {\n const errors = validatePage(metadata);\n if (errors.length) {\n return dispatch(validationError(errors));\n }\n }\n // clear errors\n dispatch({ type: CLEAR_ERRORS });\n // omit raw_content, path and empty-value keys in metadata state from front_matter\n const front_matter = _.omit(metadata, (value, key, object) => {\n return key === 'raw_content' || key === 'path' || value === '';\n });\n //send the put request\n return put(\n pageAPIUrl(directory, path),\n preparePayload({ front_matter, raw_content }),\n { type: PUT_PAGE_SUCCESS, name: 'page' },\n { type: PUT_PAGE_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const putPage = (directory, filename) => (dispatch, getState) => {\n // get edited fields from metadata state\n const metadata = getState().metadata.metadata;\n let { path, raw_content, title } = metadata;\n // if path is not given or equals to directory, generate filename from the title\n if (!path && title) {\n path = `${slugify(title)}.md`;\n } else {\n const errors = validatePage(metadata);\n if (errors.length) {\n return dispatch(validationError(errors));\n }\n }\n // clear errors\n dispatch({ type: CLEAR_ERRORS });\n // omit raw_content, path and empty-value keys in metadata state from front_matter\n const front_matter = _.omit(metadata, (value, key, object) => {\n return key === 'raw_content' || key === 'path' || value === '';\n });\n const relative_path = directory ? `${directory}/${path}` : `${path}`;\n //send the put request\n return put(\n // create or update page according to filename existence\n pageAPIUrl(directory, filename),\n preparePayload({ path: relative_path, front_matter, raw_content }),\n { type: PUT_PAGE_SUCCESS, name: 'page' },\n { type: PUT_PAGE_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const deletePage = (directory, filename) => dispatch => {\n const relative_path = computeRelativePath(directory, filename);\n return del(\n pageAPIUrl(directory, filename),\n { type: DELETE_PAGE_SUCCESS, name: 'page', id: relative_path },\n { type: DELETE_PAGE_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nconst validatePage = metadata =>\n validator(\n metadata,\n { path: 'required|filename' },\n {\n 'path.required': getTitleRequiredMessage(),\n 'path.filename': getFilenameNotValidMessage(),\n }\n );\n\nconst preparePayload = obj => JSON.stringify(trimObject(obj));\n\n// Reducer\nexport default function pages(\n state = {\n pages: [],\n page: {},\n isFetching: false,\n updated: false,\n },\n action\n) {\n switch (action.type) {\n case FETCH_PAGES_REQUEST:\n case FETCH_PAGE_REQUEST:\n return {\n ...state,\n isFetching: true,\n };\n case FETCH_PAGES_SUCCESS:\n return {\n ...state,\n pages: action.pages,\n isFetching: false,\n page: {},\n };\n case FETCH_PAGES_FAILURE:\n return {\n ...state,\n isFetching: false,\n pages: [],\n };\n case FETCH_PAGE_SUCCESS:\n return {\n ...state,\n page: action.page,\n isFetching: false,\n };\n case FETCH_PAGE_FAILURE:\n return {\n ...state,\n page: {},\n isFetching: false,\n };\n case PUT_PAGE_SUCCESS:\n return {\n ...state,\n page: action.page,\n updated: true,\n };\n case DELETE_PAGE_SUCCESS:\n return {\n ...state,\n pages: filterDeleted(state.pages, action.id),\n };\n default:\n return {\n ...state,\n updated: false,\n };\n }\n}\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport DocumentTitle from 'react-document-title';\nimport Explorer from '../../components/Explorer';\nimport { search, filterBySearchInput } from '../../ducks/utils';\nimport { fetchPages, deletePage } from '../../ducks/pages';\nimport { getDocumentTitle } from '../../utils/helpers';\n\nexport class Pages extends Component {\n componentDidMount() {\n const { fetchPages, params } = this.props;\n fetchPages(params.splat);\n }\n\n componentWillReceiveProps(nextProps) {\n const { fetchPages } = nextProps;\n if (this.props.params.splat !== nextProps.params.splat) {\n fetchPages(nextProps.params.splat);\n }\n }\n\n render() {\n const { isFetching, pages, search, params, deletePage } = this.props;\n\n if (isFetching) {\n return null;\n }\n\n const title = getDocumentTitle('pages', params.splat);\n\n return (\n <DocumentTitle title={title}>\n <Explorer\n type=\"pages\"\n items={pages}\n params={params}\n newBtnLabel=\"New page\"\n search={search}\n deleteItem={deletePage}\n />\n </DocumentTitle>\n );\n }\n}\n\nPages.propTypes = {\n pages: PropTypes.array.isRequired,\n fetchPages: PropTypes.func.isRequired,\n deletePage: PropTypes.func.isRequired,\n isFetching: PropTypes.bool.isRequired,\n search: PropTypes.func.isRequired,\n params: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n pages: filterBySearchInput(state.pages.pages, state.utils.input),\n isFetching: state.pages.isFetching,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n fetchPages,\n deletePage,\n search,\n },\n dispatch\n );\n\nexport default connect(mapStateToProps, mapDispatchToProps)(Pages);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport TextareaAutosize from 'react-textarea-autosize';\nimport moment from 'moment';\nimport Icon from '../Icon';\n\nexport default class InputFilename extends Component {\n handleChange = e => {\n const { onChange } = this.props;\n\n // The `TextareaAutosize` has a `value` attribute\n // which is supposed to be set to its inner `TextArea`'s value\n // but is always undefined\n // So this is a workaround\n this.refs.input.value = e.target.value;\n\n onChange(e.target.value);\n };\n\n render() {\n const { path, type } = this.props;\n\n let placeholder = 'example.md';\n if (type === 'posts') {\n const date = moment().format('YYYY-MM-DD');\n placeholder = `${date}-your-title.md`;\n } else if (type === 'data files') {\n placeholder = 'your-filename.yml';\n }\n\n let tooltip = null;\n if (type !== 'data files') {\n tooltip = (\n <span className=\"tooltip\">\n <Icon name=\"info-circle\" />\n <span className=\"tooltip-text\">\n If you leave <b>path</b> blank, it will be autogenerated from title.\n </span>\n </span>\n );\n }\n return (\n <div className=\"input-path\">\n <label>Path {tooltip}</label>\n <TextareaAutosize\n key={path}\n onChange={this.handleChange}\n placeholder={placeholder}\n defaultValue={path}\n ref=\"input\"\n />\n </div>\n );\n }\n}\n\nInputFilename.propTypes = {\n path: PropTypes.string.isRequired,\n type: PropTypes.string.isRequired,\n onChange: PropTypes.func.isRequired,\n};\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport TextareaAutosize from 'react-textarea-autosize';\n\nexport default class InputTitle extends Component {\n shouldComponentUpdate(nextProps) {\n return nextProps.title !== this.props.title;\n }\n\n handleChange = e => {\n const { onChange } = this.props;\n onChange(e.target.value);\n };\n\n render() {\n const { title } = this.props;\n return (\n <div className=\"input-title\">\n <label>Title</label>\n <TextareaAutosize\n onChange={this.handleChange}\n placeholder=\"Title\"\n defaultValue={title}\n ref=\"input\"\n />\n </div>\n );\n }\n}\n\nInputTitle.propTypes = {\n title: PropTypes.string.isRequired,\n onChange: PropTypes.func.isRequired,\n};\n","/* eslint-disable */\n\nimport hljs from 'highlight.js/lib/highlight';\n\n// ---\n// Languages supported as of highlight.js v9.17.1.\n//\n// We can't have a dynamic require statement below because webpack doesn't\n// evaluate statements and will therefore include all languages in the final\n// bundle unless webpack is additionally configured to not include the languages\n// we don't intend to include.\n// ---\n\nhljs.registerLanguage('actionscript', require('highlight.js/lib/languages/actionscript'));\nhljs.registerLanguage('apache', require('highlight.js/lib/languages/apache'));\nhljs.registerLanguage('applescript', require('highlight.js/lib/languages/applescript'));\nhljs.registerLanguage('asciidoc', require('highlight.js/lib/languages/asciidoc'));\nhljs.registerLanguage('bash', require('highlight.js/lib/languages/bash'));\nhljs.registerLanguage('basic', require('highlight.js/lib/languages/basic'));\nhljs.registerLanguage('clojure', require('highlight.js/lib/languages/clojure'));\nhljs.registerLanguage('clojure-repl', require('highlight.js/lib/languages/clojure-repl'));\nhljs.registerLanguage('cmake', require('highlight.js/lib/languages/cmake'));\nhljs.registerLanguage('coffeescript', require('highlight.js/lib/languages/coffeescript'));\nhljs.registerLanguage('cpp', require('highlight.js/lib/languages/cpp'));\nhljs.registerLanguage('crystal', require('highlight.js/lib/languages/crystal'));\nhljs.registerLanguage('css', require('highlight.js/lib/languages/css'));\nhljs.registerLanguage('dart', require('highlight.js/lib/languages/dart'));\nhljs.registerLanguage('diff', require('highlight.js/lib/languages/diff'));\nhljs.registerLanguage('django', require('highlight.js/lib/languages/django'));\nhljs.registerLanguage('dns', require('highlight.js/lib/languages/dns'));\nhljs.registerLanguage('dockerfile', require('highlight.js/lib/languages/dockerfile'));\nhljs.registerLanguage('dos', require('highlight.js/lib/languages/dos'));\nhljs.registerLanguage('dsconfig', require('highlight.js/lib/languages/dsconfig'));\nhljs.registerLanguage('elixir', require('highlight.js/lib/languages/elixir'));\nhljs.registerLanguage('elm', require('highlight.js/lib/languages/elm'));\nhljs.registerLanguage('erb', require('highlight.js/lib/languages/erb'));\nhljs.registerLanguage('erlang-repl', require('highlight.js/lib/languages/erlang-repl'));\nhljs.registerLanguage('erlang', require('highlight.js/lib/languages/erlang'));\nhljs.registerLanguage('excel', require('highlight.js/lib/languages/excel'));\nhljs.registerLanguage('fortran', require('highlight.js/lib/languages/fortran'));\nhljs.registerLanguage('fsharp', require('highlight.js/lib/languages/fsharp'));\nhljs.registerLanguage('gherkin', require('highlight.js/lib/languages/gherkin'));\nhljs.registerLanguage('go', require('highlight.js/lib/languages/go'));\nhljs.registerLanguage('gradle', require('highlight.js/lib/languages/gradle'));\nhljs.registerLanguage('groovy', require('highlight.js/lib/languages/groovy'));\nhljs.registerLanguage('haml', require('highlight.js/lib/languages/haml'));\nhljs.registerLanguage('handlebars', require('highlight.js/lib/languages/handlebars'));\nhljs.registerLanguage('haskell', require('highlight.js/lib/languages/haskell'));\nhljs.registerLanguage('htmlbars', require('highlight.js/lib/languages/htmlbars'));\nhljs.registerLanguage('http', require('highlight.js/lib/languages/http'));\nhljs.registerLanguage('ini', require('highlight.js/lib/languages/ini'));\nhljs.registerLanguage('java', require('highlight.js/lib/languages/java'));\nhljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript'));\nhljs.registerLanguage('json', require('highlight.js/lib/languages/json'));\nhljs.registerLanguage('julia', require('highlight.js/lib/languages/julia'));\nhljs.registerLanguage('julia-repl', require('highlight.js/lib/languages/julia-repl'));\nhljs.registerLanguage('kotlin', require('highlight.js/lib/languages/kotlin'));\nhljs.registerLanguage('ldif', require('highlight.js/lib/languages/ldif'));\nhljs.registerLanguage('less', require('highlight.js/lib/languages/less'));\nhljs.registerLanguage('lisp', require('highlight.js/lib/languages/lisp'));\nhljs.registerLanguage('livescript', require('highlight.js/lib/languages/livescript'));\nhljs.registerLanguage('lua', require('highlight.js/lib/languages/lua'));\nhljs.registerLanguage('makefile', require('highlight.js/lib/languages/makefile'));\nhljs.registerLanguage('markdown', require('highlight.js/lib/languages/markdown'));\nhljs.registerLanguage('mathematica', require('highlight.js/lib/languages/mathematica'));\nhljs.registerLanguage('matlab', require('highlight.js/lib/languages/matlab'));\nhljs.registerLanguage('perl', require('highlight.js/lib/languages/perl'));\nhljs.registerLanguage('nginx', require('highlight.js/lib/languages/nginx'));\nhljs.registerLanguage('nix', require('highlight.js/lib/languages/nix'));\nhljs.registerLanguage('objectivec', require('highlight.js/lib/languages/objectivec'));\nhljs.registerLanguage('ocaml', require('highlight.js/lib/languages/ocaml'));\nhljs.registerLanguage('pgsql', require('highlight.js/lib/languages/pgsql'));\nhljs.registerLanguage('php', require('highlight.js/lib/languages/php'));\nhljs.registerLanguage('plaintext', require('highlight.js/lib/languages/plaintext'));\nhljs.registerLanguage('powershell', require('highlight.js/lib/languages/powershell'));\nhljs.registerLanguage('prolog', require('highlight.js/lib/languages/prolog'));\nhljs.registerLanguage('python', require('highlight.js/lib/languages/python'));\nhljs.registerLanguage('r', require('highlight.js/lib/languages/r'));\nhljs.registerLanguage('reasonml', require('highlight.js/lib/languages/reasonml'));\nhljs.registerLanguage('ruby', require('highlight.js/lib/languages/ruby'));\nhljs.registerLanguage('rust', require('highlight.js/lib/languages/rust'));\nhljs.registerLanguage('scala', require('highlight.js/lib/languages/scala'));\nhljs.registerLanguage('scss', require('highlight.js/lib/languages/scss'));\nhljs.registerLanguage('shell', require('highlight.js/lib/languages/shell'));\nhljs.registerLanguage('smalltalk', require('highlight.js/lib/languages/smalltalk'));\nhljs.registerLanguage('sql', require('highlight.js/lib/languages/sql'));\nhljs.registerLanguage('swift', require('highlight.js/lib/languages/swift'));\nhljs.registerLanguage('typescript', require('highlight.js/lib/languages/typescript'));\nhljs.registerLanguage('vbnet', require('highlight.js/lib/languages/vbnet'));\nhljs.registerLanguage('vbscript', require('highlight.js/lib/languages/vbscript'));\nhljs.registerLanguage('vim', require('highlight.js/lib/languages/vim'));\nhljs.registerLanguage('yaml', require('highlight.js/lib/languages/yaml'));\nhljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'));\n\n// ---\n// Uncomment below to include that language in the final build\n// ---\n\n// hljs.registerLanguage('1c', require('highlight.js/lib/languages/1c'));\n// hljs.registerLanguage('abnf', require('highlight.js/lib/languages/abnf'));\n// hljs.registerLanguage('accesslog', require('highlight.js/lib/languages/accesslog'));\n// hljs.registerLanguage('ada', require('highlight.js/lib/languages/ada'));\n// hljs.registerLanguage('angelscript', require('highlight.js/lib/languages/angelscript'));\n// hljs.registerLanguage('arcade', require('highlight.js/lib/languages/arcade'));\n// hljs.registerLanguage('arduino', require('highlight.js/lib/languages/arduino'));\n// hljs.registerLanguage('armasm', require('highlight.js/lib/languages/armasm'));\n// hljs.registerLanguage('aspectj', require('highlight.js/lib/languages/aspectj'));\n// hljs.registerLanguage('autohotkey', require('highlight.js/lib/languages/autohotkey'));\n// hljs.registerLanguage('autoit', require('highlight.js/lib/languages/autoit'));\n// hljs.registerLanguage('avrasm', require('highlight.js/lib/languages/avrasm'));\n// hljs.registerLanguage('awk', require('highlight.js/lib/languages/awk'));\n// hljs.registerLanguage('axapta', require('highlight.js/lib/languages/axapta'));\n// hljs.registerLanguage('bnf', require('highlight.js/lib/languages/bnf'));\n// hljs.registerLanguage('brainfuck', require('highlight.js/lib/languages/brainfuck'));\n// hljs.registerLanguage('cal', require('highlight.js/lib/languages/cal'));\n// hljs.registerLanguage('capnproto', require('highlight.js/lib/languages/capnproto'));\n// hljs.registerLanguage('ceylon', require('highlight.js/lib/languages/ceylon'));\n// hljs.registerLanguage('clean', require('highlight.js/lib/languages/clean'));\n// hljs.registerLanguage('coq', require('highlight.js/lib/languages/coq'));\n// hljs.registerLanguage('cos', require('highlight.js/lib/languages/cos'));\n// hljs.registerLanguage('crmsh', require('highlight.js/lib/languages/crmsh'));\n// hljs.registerLanguage('cs', require('highlight.js/lib/languages/cs'));\n// hljs.registerLanguage('csp', require('highlight.js/lib/languages/csp'));\n// hljs.registerLanguage('d', require('highlight.js/lib/languages/d'));\n// hljs.registerLanguage('delphi', require('highlight.js/lib/languages/delphi'));\n// hljs.registerLanguage('dts', require('highlight.js/lib/languages/dts'));\n// hljs.registerLanguage('dust', require('highlight.js/lib/languages/dust'));\n// hljs.registerLanguage('ebnf', require('highlight.js/lib/languages/ebnf'));\n// hljs.registerLanguage('fix', require('highlight.js/lib/languages/fix'));\n// hljs.registerLanguage('flix', require('highlight.js/lib/languages/flix'));\n// hljs.registerLanguage('gams', require('highlight.js/lib/languages/gams'));\n// hljs.registerLanguage('gauss', require('highlight.js/lib/languages/gauss'));\n// hljs.registerLanguage('gcode', require('highlight.js/lib/languages/gcode'));\n// hljs.registerLanguage('glsl', require('highlight.js/lib/languages/glsl'));\n// hljs.registerLanguage('gml', require('highlight.js/lib/languages/gml'));\n// hljs.registerLanguage('golo', require('highlight.js/lib/languages/golo'));\n// hljs.registerLanguage('haxe', require('highlight.js/lib/languages/haxe'));\n// hljs.registerLanguage('hsp', require('highlight.js/lib/languages/hsp'));\n// hljs.registerLanguage('hy', require('highlight.js/lib/languages/hy'));\n// hljs.registerLanguage('inform7', require('highlight.js/lib/languages/inform7'));\n// hljs.registerLanguage('irpf90', require('highlight.js/lib/languages/irpf90'));\n// hljs.registerLanguage('isbl', require('highlight.js/lib/languages/isbl'));\n// hljs.registerLanguage('jboss-cli', require('highlight.js/lib/languages/jboss-cli'));\n// hljs.registerLanguage('lasso', require('highlight.js/lib/languages/lasso'));\n// hljs.registerLanguage('leaf', require('highlight.js/lib/languages/leaf'));\n// hljs.registerLanguage('livecodeserver', require('highlight.js/lib/languages/livecodeserver'));\n// hljs.registerLanguage('llvm', require('highlight.js/lib/languages/llvm'));\n// hljs.registerLanguage('lsl', require('highlight.js/lib/languages/lsl'));\n// hljs.registerLanguage('maxima', require('highlight.js/lib/languages/maxima'));\n// hljs.registerLanguage('mel', require('highlight.js/lib/languages/mel'));\n// hljs.registerLanguage('mercury', require('highlight.js/lib/languages/mercury'));\n// hljs.registerLanguage('mipsasm', require('highlight.js/lib/languages/mipsasm'));\n// hljs.registerLanguage('mizar', require('highlight.js/lib/languages/mizar'));\n// hljs.registerLanguage('mojolicious', require('highlight.js/lib/languages/mojolicious'));\n// hljs.registerLanguage('monkey', require('highlight.js/lib/languages/monkey'));\n// hljs.registerLanguage('moonscript', require('highlight.js/lib/languages/moonscript'));\n// hljs.registerLanguage('n1ql', require('highlight.js/lib/languages/n1ql'));\n// hljs.registerLanguage('nimrod', require('highlight.js/lib/languages/nimrod'));\n// hljs.registerLanguage('nsis', require('highlight.js/lib/languages/nsis'));\n// hljs.registerLanguage('openscad', require('highlight.js/lib/languages/openscad'));\n// hljs.registerLanguage('oxygene', require('highlight.js/lib/languages/oxygene'));\n// hljs.registerLanguage('parser3', require('highlight.js/lib/languages/parser3'));\n// hljs.registerLanguage('pf', require('highlight.js/lib/languages/pf'));\n// hljs.registerLanguage('pony', require('highlight.js/lib/languages/pony'));\n// hljs.registerLanguage('processing', require('highlight.js/lib/languages/processing'));\n// hljs.registerLanguage('profile', require('highlight.js/lib/languages/profile'));\n// hljs.registerLanguage('properties', require('highlight.js/lib/languages/properties'));\n// hljs.registerLanguage('protobuf', require('highlight.js/lib/languages/protobuf'));\n// hljs.registerLanguage('puppet', require('highlight.js/lib/languages/puppet'));\n// hljs.registerLanguage('purebasic', require('highlight.js/lib/languages/purebasic'));\n// hljs.registerLanguage('q', require('highlight.js/lib/languages/q'));\n// hljs.registerLanguage('qml', require('highlight.js/lib/languages/qml'));\n// hljs.registerLanguage('rib', require('highlight.js/lib/languages/rib'));\n// hljs.registerLanguage('roboconf', require('highlight.js/lib/languages/roboconf'));\n// hljs.registerLanguage('routeros', require('highlight.js/lib/languages/routeros'));\n// hljs.registerLanguage('rsl', require('highlight.js/lib/languages/rsl'));\n// hljs.registerLanguage('ruleslanguage', require('highlight.js/lib/languages/ruleslanguage'));\n// hljs.registerLanguage('sas', require('highlight.js/lib/languages/sas'));\n// hljs.registerLanguage('scheme', require('highlight.js/lib/languages/scheme'));\n// hljs.registerLanguage('scilab', require('highlight.js/lib/languages/scilab'));\n// hljs.registerLanguage('smali', require('highlight.js/lib/languages/smali'));\n// hljs.registerLanguage('sml', require('highlight.js/lib/languages/sml'));\n// hljs.registerLanguage('sqf', require('highlight.js/lib/languages/sqf'));\n// hljs.registerLanguage('stan', require('highlight.js/lib/languages/stan'));\n// hljs.registerLanguage('stata', require('highlight.js/lib/languages/stata'));\n// hljs.registerLanguage('step21', require('highlight.js/lib/languages/step21'));\n// hljs.registerLanguage('stylus', require('highlight.js/lib/languages/stylus'));\n// hljs.registerLanguage('subunit', require('highlight.js/lib/languages/subunit'));\n// hljs.registerLanguage('taggerscript', require('highlight.js/lib/languages/taggerscript'));\n// hljs.registerLanguage('tap', require('highlight.js/lib/languages/tap'));\n// hljs.registerLanguage('tcl', require('highlight.js/lib/languages/tcl'));\n// hljs.registerLanguage('tex', require('highlight.js/lib/languages/tex'));\n// hljs.registerLanguage('thrift', require('highlight.js/lib/languages/thrift'));\n// hljs.registerLanguage('tp', require('highlight.js/lib/languages/tp'));\n// hljs.registerLanguage('twig', require('highlight.js/lib/languages/twig'));\n// hljs.registerLanguage('vala', require('highlight.js/lib/languages/vala'));\n// hljs.registerLanguage('vbscript-html', require('highlight.js/lib/languages/vbscript-html'));\n// hljs.registerLanguage('verilog', require('highlight.js/lib/languages/verilog'));\n// hljs.registerLanguage('vhdl', require('highlight.js/lib/languages/vhdl'));\n// hljs.registerLanguage('x86asm', require('highlight.js/lib/languages/x86asm'));\n// hljs.registerLanguage('xl', require('highlight.js/lib/languages/xl'));\n// hljs.registerLanguage('xquery', require('highlight.js/lib/languages/xquery'));\n// hljs.registerLanguage('zephir', require('highlight.js/lib/languages/zephir'));\n\nexport default hljs;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport SimpleMDE from 'simplemde';\nimport hljs from '../utils/highlighter';\nimport FilePicker from './FilePicker';\nimport { getExtensionFromPath } from '../utils/helpers';\n\nconst classNames = [\n 'editor-toolbar',\n 'CodeMirror',\n 'editor-preview-side',\n 'editor-statusbar',\n];\n\nclass MarkdownEditor extends Component {\n componentDidMount() {\n this.create();\n window.hljs = hljs; // TODO: fix this after the next release of SimpleMDE\n }\n\n shouldComponentUpdate(nextProps) {\n return nextProps.initialValue !== this.props.initialValue;\n }\n\n componentDidUpdate() {\n this.destroy();\n this.create();\n }\n\n componentWillUnmount() {\n this.destroy();\n }\n\n create() {\n const { onChange, onSave } = this.props;\n let opts = Object.create(this.props);\n opts['element'] = this.refs.text;\n opts['autoDownloadFontAwesome'] = false;\n opts['spellChecker'] = false;\n opts['renderingConfig'] = {\n codeSyntaxHighlighting: true,\n };\n opts['insertTexts'] = {\n image: ['![', '](#url#)'],\n };\n let toolbarIcons = [\n 'bold',\n 'italic',\n 'heading',\n '|',\n 'code',\n 'quote',\n 'unordered-list',\n 'ordered-list',\n '|',\n 'link',\n 'image',\n 'table',\n {\n name: 'filepicker',\n action: () => this.refs.filepicker.refs.trigger.click(),\n className: 'fa fa-paperclip',\n title: 'Insert Static File',\n },\n '|',\n 'preview',\n 'side-by-side',\n 'fullscreen',\n '|',\n ];\n if (onSave) {\n toolbarIcons.push({\n name: 'save',\n action: onSave,\n className: 'fa fa-floppy-o',\n title: 'Save',\n });\n }\n opts['toolbar'] = toolbarIcons;\n const editor = new SimpleMDE(opts);\n if (editor.codemirror) {\n editor.codemirror.on('change', () => {\n onChange(editor.value());\n });\n }\n this.editor = editor;\n }\n\n destroy() {\n for (let i in classNames) {\n let elementToRemove = this.refs.container.querySelector(\n '.' + classNames[i]\n );\n elementToRemove && elementToRemove.remove();\n }\n }\n\n // Adapted from an internal helper function within SimpleMDE package.\n _replaceSelectedText = (cm, headNTail, url) => {\n const startPoint = cm.getCursor('start');\n const endPoint = cm.getCursor('end');\n const text = cm.getSelection();\n\n let [head, tail] = headNTail;\n if (url) {\n tail = tail.replace('#url#', url);\n }\n\n cm.replaceSelection(`${head}${text}${tail}`);\n startPoint.ch += head.length;\n\n if (startPoint !== endPoint) {\n endPoint.ch += head.length;\n }\n\n cm.setSelection(startPoint, endPoint);\n cm.focus();\n };\n\n handleFilePick = path => {\n const { codemirror, options } = this.editor;\n const { image, link } = options.insertTexts;\n const url = `{{ '${path}' | relative_url }}`;\n const ext = getExtensionFromPath(path);\n\n const type = /png|jpg|gif|jpeg|svg|ico/i.test(ext) ? image : link;\n this._replaceSelectedText(codemirror, type, url);\n };\n\n render() {\n return (\n <div>\n <div style={{ display: 'none' }}>\n <FilePicker ref=\"filepicker\" onPick={this.handleFilePick} />\n </div>\n <div ref=\"container\">\n <textarea ref=\"text\" />\n </div>\n </div>\n );\n }\n}\n\nMarkdownEditor.propTypes = {\n initialValue: PropTypes.string.isRequired,\n onChange: PropTypes.func.isRequired,\n onSave: PropTypes.func.isRequired,\n};\n\nexport default MarkdownEditor;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport TextareaAutosize from 'react-textarea-autosize';\n\nexport default function StaticMetaSimple({ fieldValue }) {\n return (\n <div className=\"meta-value\">\n <TextareaAutosize\n className=\"field value-field\"\n value={`${fieldValue}`}\n disabled\n />\n </div>\n );\n}\n\nStaticMetaSimple.propTypes = {\n fieldValue: PropTypes.any.isRequired,\n};\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport StaticMetaArray from './StaticMetaArray';\nimport StaticMetaObject from './StaticMetaObject';\nimport StaticMetaSimple from './StaticMetaSimple';\n\nconst FieldTypes = {\n array: StaticMetaArray,\n object: StaticMetaObject,\n simple: StaticMetaSimple,\n};\n\nexport default function StaticMetaObjectItem({ type, fieldKey, fieldValue }) {\n const CurrentComponent = FieldTypes[type];\n\n return (\n <div className=\"object-item-wrap\">\n <div className={`object-key ${type}`}>\n <input\n value={fieldKey}\n className=\"field key-field\"\n type=\"text\"\n disabled\n />\n </div>\n <div className=\"object-value\">\n <CurrentComponent fieldValue={fieldValue} />\n </div>\n </div>\n );\n}\n\nStaticMetaObjectItem.propTypes = {\n type: PropTypes.string.isRequired,\n fieldKey: PropTypes.string.isRequired,\n fieldValue: PropTypes.any.isRequired,\n};\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport _ from 'underscore';\nimport StaticMetaObjectItem from './StaticMetaObjectItem';\nimport { computeFieldType } from '../../../utils/metadata';\n\nexport default function StaticMetaObject({ fieldValue }) {\n const items = _.map(fieldValue, (value, key) => {\n const type = computeFieldType(value);\n return (\n <StaticMetaObjectItem\n key={key}\n fieldKey={key}\n fieldValue={value}\n type={type}\n />\n );\n });\n\n return <div className=\"meta-value-object\">{items}</div>;\n}\n\nStaticMetaObject.propTypes = {\n fieldValue: PropTypes.any.isRequired,\n};\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport StaticMetaArray from './StaticMetaArray';\nimport StaticMetaObject from './StaticMetaObject';\nimport StaticMetaSimple from './StaticMetaSimple';\n\nconst FieldTypes = {\n array: StaticMetaArray,\n object: StaticMetaObject,\n simple: StaticMetaSimple,\n};\n\nexport default function StaticMetaArrayItem({ type, fieldValue, index }) {\n const CurrentComponent = FieldTypes[type];\n\n return (\n <div className=\"array-item-wrap\">\n <div className=\"array\">\n <div className=\"array-header\">\n <span className=\"array-field-num\">{index + 1}.</span>\n </div>\n <CurrentComponent fieldValue={fieldValue} />\n </div>\n </div>\n );\n}\n\nStaticMetaArrayItem.propTypes = {\n type: PropTypes.string.isRequired,\n index: PropTypes.number.isRequired,\n fieldValue: PropTypes.any.isRequired,\n};\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport StaticMetaArrayItem from './StaticMetaArrayItem';\nimport { computeFieldType } from '../../../utils/metadata';\n\nexport default function StaticMetaArray({ fieldValue }) {\n const items = fieldValue.map((item, i) => {\n const type = computeFieldType(item);\n return (\n <StaticMetaArrayItem key={i} index={i} fieldValue={item} type={type} />\n );\n });\n return <div className=\"meta-value-array\">{items}</div>;\n}\n\nStaticMetaArray.propTypes = {\n fieldValue: PropTypes.any.isRequired,\n};\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport StaticMetaArray from './StaticMetaArray';\nimport StaticMetaObject from './StaticMetaObject';\nimport StaticMetaSimple from './StaticMetaSimple';\n\nconst FieldTypes = {\n array: StaticMetaArray,\n object: StaticMetaObject,\n simple: StaticMetaSimple,\n};\n\nexport default function StaticMetaField({ type, fieldKey, fieldValue }) {\n const CurrentComponent = FieldTypes[type];\n\n return (\n <div className=\"metafield\">\n <div className={`meta-key ${type}`}>\n <input\n value={fieldKey}\n className=\"field key-field\"\n type=\"text\"\n disabled\n />\n </div>\n <CurrentComponent fieldValue={fieldValue} />\n </div>\n );\n}\n\nStaticMetaField.propTypes = {\n type: PropTypes.string.isRequired,\n fieldKey: PropTypes.string.isRequired,\n fieldValue: PropTypes.any.isRequired,\n};\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport _ from 'underscore';\nimport StaticMetaField from './statics/StaticMetaField';\nimport { computeFieldType } from '../../utils/metadata';\n\nexport default function StaticMetaFields({ fields }) {\n const filteredData = _.omit(fields, ['raw_content']);\n const metafields = _.map(filteredData, (value, key) => {\n const type = computeFieldType(value);\n return (\n <StaticMetaField\n key={key}\n type={type}\n fieldKey={key}\n fieldValue={value}\n />\n );\n });\n\n return (\n <div id=\"defaults\" className=\"metafields\" title=\"Default Front Matter\">\n {metafields}\n </div>\n );\n}\n\nStaticMetaFields.propTypes = {\n fields: PropTypes.object.isRequired,\n};\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport Splitter from './Splitter';\nimport InputPath from './form/InputPath';\nimport InputTitle from './form/InputTitle';\nimport MarkdownEditor from './MarkdownEditor';\nimport StaticMetaData from './metadata/StaticMetaFields';\nimport Metadata from '../containers/MetaFields';\n\nexport default function MarkdownPageBody({\n type,\n path,\n body,\n title,\n onSave,\n updateTitle,\n updatePath,\n updateBody,\n metafields,\n staticmetafields,\n}) {\n return (\n <div className=\"content-body\">\n <InputPath onChange={updatePath} type={type} path={path} />\n <InputTitle onChange={updateTitle} title={title} />\n <MarkdownEditor\n onChange={updateBody}\n onSave={onSave}\n placeholder=\"Body\"\n initialValue={body}\n />\n <Splitter />\n <StaticMetaData fields={staticmetafields} />\n <Metadata fields={metafields} />\n </div>\n );\n}\n\nMarkdownPageBody.defaultProps = {\n path: '',\n body: '',\n title: '',\n metafields: {},\n staticmetafields: {},\n};\n\nMarkdownPageBody.propTypes = {\n updateBody: PropTypes.func.isRequired,\n updatePath: PropTypes.func.isRequired,\n updateTitle: PropTypes.func.isRequired,\n onSave: PropTypes.func.isRequired,\n type: PropTypes.string.isRequired,\n path: PropTypes.string,\n body: PropTypes.string,\n title: PropTypes.string,\n metafields: PropTypes.object,\n staticmetafields: PropTypes.object,\n};\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { browserHistory, withRouter } from 'react-router';\nimport { HotKeys } from 'react-hotkeys';\nimport _ from 'underscore';\nimport DocumentTitle from 'react-document-title';\nimport Button from '../../components/Button';\nimport Errors from '../../components/Errors';\nimport Splitter from '../../components/Splitter';\nimport Breadcrumbs from '../../components/Breadcrumbs';\nimport MarkdownPageBody from '../../components/MarkdownPageBody';\nimport { fetchPage, deletePage, putPage } from '../../ducks/pages';\nimport { updateTitle, updateBody, updatePath } from '../../ducks/metadata';\nimport { clearErrors } from '../../ducks/utils';\nimport { preventDefault, getDocumentTitle } from '../../utils/helpers';\nimport { ADMIN_PREFIX } from '../../constants';\n\nimport translations from '../../translations';\nconst { getLeaveMessage, getDeleteMessage } = translations;\n\nexport class PageEdit extends Component {\n componentDidMount() {\n const { fetchPage, params, router, route } = this.props;\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n fetchPage(directory, filename);\n\n router.setRouteLeaveHook(route, this.routerWillLeave);\n }\n\n componentWillReceiveProps(nextProps) {\n if (this.props.updated !== nextProps.updated) {\n const new_path = nextProps.page.path;\n const path = this.props.page.path;\n // redirect if the path is changed\n if (new_path !== path) {\n browserHistory.push(`${ADMIN_PREFIX}/pages/${new_path}`);\n }\n }\n }\n\n componentWillUnmount() {\n const { clearErrors, errors } = this.props;\n errors.length && clearErrors();\n }\n\n routerWillLeave = nextLocation => {\n if (this.props.fieldChanged) {\n return getLeaveMessage();\n }\n };\n\n handleClickSave = e => {\n preventDefault(e);\n const { putPage, fieldChanged, params } = this.props;\n if (fieldChanged) {\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n putPage(directory, filename);\n }\n };\n\n handleClickDelete(name) {\n const { deletePage, params } = this.props;\n const confirm = window.confirm(getDeleteMessage(name));\n if (confirm) {\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n deletePage(directory, filename);\n browserHistory.push(`${ADMIN_PREFIX}/pages/${directory || ''}`);\n }\n }\n\n render() {\n const {\n isFetching,\n page,\n errors,\n updateTitle,\n updateBody,\n updatePath,\n updated,\n fieldChanged,\n params,\n } = this.props;\n\n if (isFetching) {\n return null;\n }\n\n if (_.isEmpty(page)) {\n return <h1>{`Could not find the page.`}</h1>;\n }\n\n const keyboardHandlers = {\n save: this.handleClickSave,\n };\n\n const {\n name,\n raw_content,\n http_url,\n front_matter,\n front_matter_defaults,\n } = page;\n const directory = params.splat[0];\n\n const title = front_matter && front_matter.title ? front_matter.title : '';\n const document_title = getDocumentTitle('pages', directory, title || name);\n\n return (\n <DocumentTitle title={document_title}>\n <HotKeys handlers={keyboardHandlers} className=\"single\">\n {errors.length > 0 && <Errors errors={errors} />}\n\n <div className=\"content-header\">\n <Breadcrumbs type=\"pages\" splat={directory} />\n </div>\n\n <div className=\"content-wrapper\">\n <MarkdownPageBody\n type=\"pages\"\n updateTitle={updateTitle}\n updatePath={updatePath}\n updateBody={updateBody}\n onSave={this.handleClickSave}\n path={name}\n title={title}\n body={raw_content}\n metafields={{ title, raw_content, path: name, ...front_matter }}\n staticmetafields={front_matter_defaults}\n />\n <div className=\"content-side\">\n <Button\n onClick={this.handleClickSave}\n type=\"save\"\n active={fieldChanged}\n triggered={updated}\n block\n />\n <Button to={http_url} type=\"view\" active block />\n <Splitter />\n <Button\n onClick={() => this.handleClickDelete(name)}\n type=\"delete\"\n active\n block\n />\n </div>\n </div>\n </HotKeys>\n </DocumentTitle>\n );\n }\n}\n\nPageEdit.propTypes = {\n page: PropTypes.object.isRequired,\n fetchPage: PropTypes.func.isRequired,\n deletePage: PropTypes.func.isRequired,\n putPage: PropTypes.func.isRequired,\n updateTitle: PropTypes.func.isRequired,\n updateBody: PropTypes.func.isRequired,\n updatePath: PropTypes.func.isRequired,\n clearErrors: PropTypes.func.isRequired,\n isFetching: PropTypes.bool.isRequired,\n errors: PropTypes.array.isRequired,\n fieldChanged: PropTypes.bool.isRequired,\n updated: PropTypes.bool.isRequired,\n params: PropTypes.object.isRequired,\n router: PropTypes.object.isRequired,\n route: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n page: state.pages.page,\n isFetching: state.pages.isFetching,\n fieldChanged: state.metadata.fieldChanged,\n updated: state.pages.updated,\n errors: state.utils.errors,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n fetchPage,\n deletePage,\n putPage,\n updateTitle,\n updateBody,\n updatePath,\n clearErrors,\n },\n dispatch\n );\n\nexport default withRouter(\n connect(mapStateToProps, mapDispatchToProps)(PageEdit)\n);\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport { HotKeys } from 'react-hotkeys';\nimport Button from './Button';\nimport Errors from './Errors';\nimport Breadcrumbs from './Breadcrumbs';\nimport MarkdownPageBody from './MarkdownPageBody';\nimport { injectDefaultFields as defaultFields } from '../utils/metadata';\n\nexport default function CreateMarkdownPage({\n type,\n config,\n errors,\n updated,\n updateBody,\n updatePath,\n updateTitle,\n fieldChanged,\n onClickSave,\n params: { splat },\n}) {\n const metaType = type === 'drafts' ? 'posts' : type;\n\n return (\n <HotKeys handlers={{ save: onClickSave }}>\n {errors.length > 0 && <Errors errors={errors} />}\n\n <div className=\"content-header\">\n <Breadcrumbs type={type} splat={splat} />\n </div>\n\n <div className=\"content-wrapper\">\n <MarkdownPageBody\n type={type}\n updatePath={updatePath}\n updateTitle={updateTitle}\n updateBody={updateBody}\n onSave={onClickSave}\n staticmetafields={defaultFields(config, splat, metaType)}\n />\n <div className=\"content-side\">\n <Button\n onClick={onClickSave}\n type=\"create\"\n active={fieldChanged}\n triggered={updated}\n block\n />\n </div>\n </div>\n </HotKeys>\n );\n}\n\nCreateMarkdownPage.propTypes = {\n type: PropTypes.string.isRequired,\n config: PropTypes.object.isRequired,\n params: PropTypes.object.isRequired,\n errors: PropTypes.array.isRequired,\n updated: PropTypes.bool.isRequired,\n fieldChanged: PropTypes.bool.isRequired,\n updateBody: PropTypes.func.isRequired,\n updatePath: PropTypes.func.isRequired,\n updateTitle: PropTypes.func.isRequired,\n onClickSave: PropTypes.func.isRequired,\n};\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { browserHistory, withRouter } from 'react-router';\nimport DocumentTitle from 'react-document-title';\nimport CreateMarkdownPage from '../../components/CreateMarkdownPage';\nimport { updateTitle, updateBody, updatePath } from '../../ducks/metadata';\nimport { createPage } from '../../ducks/pages';\nimport { clearErrors } from '../../ducks/utils';\nimport { preventDefault, getDocumentTitle } from '../../utils/helpers';\nimport { ADMIN_PREFIX } from '../../constants';\n\nimport translations from '../../translations';\nconst { getLeaveMessage } = translations;\n\nexport class PageNew extends Component {\n componentDidMount() {\n const { router, route } = this.props;\n router.setRouteLeaveHook(route, this.routerWillLeave);\n }\n\n componentWillReceiveProps(nextProps) {\n if (this.props.updated !== nextProps.updated) {\n browserHistory.push(`${ADMIN_PREFIX}/pages/${nextProps.page.path}`);\n }\n }\n\n componentWillUnmount() {\n const { clearErrors, errors } = this.props;\n errors.length && clearErrors();\n }\n\n routerWillLeave = nextLocation => {\n if (this.props.fieldChanged) {\n return getLeaveMessage();\n }\n };\n\n handleClickSave = e => {\n preventDefault(e);\n const { fieldChanged, createPage, params } = this.props;\n fieldChanged && createPage(params.splat);\n };\n\n render() {\n const {\n params,\n config,\n errors,\n updated,\n updateBody,\n updatePath,\n updateTitle,\n fieldChanged,\n } = this.props;\n\n const title = getDocumentTitle('pages', params.splat, 'New page');\n\n return (\n <DocumentTitle title={title}>\n <CreateMarkdownPage\n type=\"pages\"\n params={params}\n config={config}\n errors={errors}\n updated={updated}\n updateBody={updateBody}\n updatePath={updatePath}\n updateTitle={updateTitle}\n fieldChanged={fieldChanged}\n onClickSave={this.handleClickSave}\n />\n </DocumentTitle>\n );\n }\n}\n\nPageNew.propTypes = {\n createPage: PropTypes.func.isRequired,\n updateTitle: PropTypes.func.isRequired,\n updateBody: PropTypes.func.isRequired,\n updatePath: PropTypes.func.isRequired,\n clearErrors: PropTypes.func.isRequired,\n errors: PropTypes.array.isRequired,\n fieldChanged: PropTypes.bool.isRequired,\n updated: PropTypes.bool.isRequired,\n router: PropTypes.object.isRequired,\n route: PropTypes.object.isRequired,\n params: PropTypes.object.isRequired,\n config: PropTypes.object.isRequired,\n page: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n page: state.pages.page,\n fieldChanged: state.metadata.fieldChanged,\n errors: state.utils.errors,\n updated: state.pages.updated,\n config: state.config.config,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n updateTitle,\n updateBody,\n updatePath,\n createPage,\n clearErrors,\n },\n dispatch\n );\n\nexport default withRouter(\n connect(mapStateToProps, mapDispatchToProps)(PageNew)\n);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { Link } from 'react-router';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport _ from 'underscore';\nimport moment from 'moment';\nimport DocumentTitle from 'react-document-title';\nimport InputSearch from '../../components/form/InputSearch';\nimport Breadcrumbs from '../../components/Breadcrumbs';\nimport Button from '../../components/Button';\nimport Icon from '../../components/Icon';\nimport {\n fetchCollection,\n deleteDocument,\n filterBySearchInput,\n} from '../../ducks/collections';\nimport { search } from '../../ducks/utils';\nimport { getDocumentTitle } from '../../utils/helpers';\nimport { ADMIN_PREFIX } from '../../constants';\n\nimport translations from '../../translations';\nconst { getDeleteMessage, getNotFoundMessage } = translations;\n\nexport class Documents extends Component {\n componentDidMount() {\n const { fetchCollection, params } = this.props;\n fetchCollection(params.collection_name, params.splat);\n }\n\n componentWillReceiveProps(nextProps) {\n const { fetchCollection, params } = nextProps;\n // refetch the collection when navigating between collections or when splat is changed\n if (\n params.splat !== this.props.params.splat ||\n params.collection_name !== this.props.params.collection_name\n ) {\n fetchCollection(params.collection_name, params.splat);\n }\n }\n\n handleClickDelete(filename) {\n const { deleteDocument, params } = this.props;\n const confirm = window.confirm(getDeleteMessage(filename));\n confirm && deleteDocument(params.collection_name, params.splat, filename);\n }\n\n renderTable() {\n return (\n <div className=\"content-table\">\n <table>\n <thead>\n <tr>\n <th>Name</th>\n <th>Date</th>\n <th className=\"th-actions\">Actions</th>\n </tr>\n </thead>\n <tbody>{this.renderRows()}</tbody>\n </table>\n </div>\n );\n }\n\n renderFileRow(doc) {\n const { id, name, title, http_url, collection, relative_path } = doc;\n const to = `${ADMIN_PREFIX}/collections/${collection}/${relative_path}`;\n // date w/o timezone\n let date = doc.date.substring(0, doc.date.lastIndexOf(' '));\n date =\n moment(date).format('hh:mm:ss') === '12:00:00'\n ? moment(date).format('ll')\n : moment(date).format('lll');\n\n return (\n <tr key={id}>\n <td className=\"row-title\">\n <strong>\n <Link to={to}>\n <Icon name=\"file-text-o\" />\n {title || name}\n </Link>\n </strong>\n </td>\n <td>{date}</td>\n <td>\n <div className=\"row-actions\">\n <Button\n onClick={() => this.handleClickDelete(name)}\n type=\"delete\"\n active\n thin\n />\n {http_url && <Button to={http_url} type=\"view\" active thin />}\n </div>\n </td>\n </tr>\n );\n }\n\n renderDirectoryRow(directory) {\n const { params: { collection_name } } = this.props;\n const { name, relative_path, modified_time } = directory;\n const to = `${ADMIN_PREFIX}/collections/${collection_name}/${relative_path}`;\n // date w/o timezone\n let date = modified_time.substring(0, modified_time.lastIndexOf(' '));\n date = moment(date).format('ll');\n return (\n <tr key={name}>\n <td className=\"row-title\">\n <strong>\n <Link to={to}>\n <Icon name=\"folder\" />\n {name}\n </Link>\n </strong>\n </td>\n <td>{date}</td>\n <td />\n </tr>\n );\n }\n\n renderRows() {\n const { documents } = this.props;\n return _.map(documents, entry => {\n if (entry.type && entry.type === 'directory') {\n return this.renderDirectoryRow(entry);\n } else {\n return this.renderFileRow(entry);\n }\n });\n }\n\n render() {\n const { isFetching, documents, search, params } = this.props;\n const { collection_name } = params;\n\n if (isFetching) {\n return null;\n }\n\n const splat = params.splat || '';\n const to = params.splat\n ? `${ADMIN_PREFIX}/collections/${collection_name}/${splat}/new`\n : `${ADMIN_PREFIX}/collections/${collection_name}/new`;\n\n const document_title = getDocumentTitle(collection_name, params.splat);\n\n return (\n <DocumentTitle title={document_title}>\n <div>\n <div className=\"content-header\">\n <Breadcrumbs type={collection_name} splat={splat} />\n <div className=\"page-buttons\">\n <Link className=\"btn btn-active\" to={to}>\n {collection_name === 'posts' ? 'New post' : 'New document'}\n </Link>\n </div>\n <div className=\"pull-right\">\n <InputSearch searchBy=\"title\" search={search} />\n </div>\n </div>\n {documents.length > 0 && this.renderTable()}\n {!documents.length && <h1>{getNotFoundMessage('documents')}</h1>}\n </div>\n </DocumentTitle>\n );\n }\n}\n\nDocuments.propTypes = {\n isFetching: PropTypes.bool.isRequired,\n documents: PropTypes.array.isRequired,\n fetchCollection: PropTypes.func.isRequired,\n deleteDocument: PropTypes.func.isRequired,\n search: PropTypes.func.isRequired,\n params: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n documents: filterBySearchInput(state.collections.entries, state.utils.input),\n isFetching: state.collections.isFetching,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n fetchCollection,\n deleteDocument,\n search,\n },\n dispatch\n );\n\nexport default connect(mapStateToProps, mapDispatchToProps)(Documents);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { browserHistory, withRouter } from 'react-router';\nimport { HotKeys } from 'react-hotkeys';\nimport _ from 'underscore';\nimport DocumentTitle from 'react-document-title';\nimport Button from '../../components/Button';\nimport Errors from '../../components/Errors';\nimport Splitter from '../../components/Splitter';\nimport Breadcrumbs from '../../components/Breadcrumbs';\nimport MarkdownPageBody from '../../components/MarkdownPageBody';\nimport {\n fetchDocument,\n deleteDocument,\n putDocument,\n} from '../../ducks/collections';\nimport { updateTitle, updateBody, updatePath } from '../../ducks/metadata';\nimport { clearErrors } from '../../ducks/utils';\nimport { preventDefault, getDocumentTitle } from '../../utils/helpers';\nimport { ADMIN_PREFIX } from '../../constants';\n\nimport translations from '../../translations';\nconst { getLeaveMessage, getDeleteMessage, getNotFoundMessage } = translations;\n\nexport class DocumentEdit extends Component {\n componentDidMount() {\n const { fetchDocument, params, router, route } = this.props;\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n fetchDocument(params.collection_name, directory, filename);\n router.setRouteLeaveHook(route, this.routerWillLeave);\n }\n\n componentWillReceiveProps(nextProps) {\n const { currentDocument } = this.props;\n if (this.props.updated !== nextProps.updated) {\n const new_path = nextProps.currentDocument.path;\n const path = currentDocument.path;\n // redirect if the path is changed\n if (new_path !== path) {\n browserHistory.push(\n `${ADMIN_PREFIX}/collections/${new_path.substring(1)}` // remove `_`\n );\n }\n }\n }\n\n componentWillUnmount() {\n const { clearErrors, errors } = this.props;\n errors.length && clearErrors();\n }\n\n routerWillLeave = nextLocation => {\n if (this.props.fieldChanged) {\n return getLeaveMessage();\n }\n };\n\n handleClickSave = e => {\n preventDefault(e);\n const { putDocument, fieldChanged, params } = this.props;\n if (fieldChanged) {\n const collection = params.collection_name;\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n putDocument(collection, directory, filename);\n }\n };\n\n handleClickDelete = () => {\n const { deleteDocument, params } = this.props;\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n const confirm = window.confirm(getDeleteMessage(filename));\n if (confirm) {\n const collection = params.collection_name;\n deleteDocument(collection, directory, filename);\n browserHistory.push(\n `${ADMIN_PREFIX}/collections/${collection}/${directory || ''}`\n );\n }\n };\n\n render() {\n const {\n isFetching,\n currentDocument,\n errors,\n updateTitle,\n updateBody,\n updatePath,\n updated,\n fieldChanged,\n params,\n } = this.props;\n\n if (isFetching) {\n return null;\n }\n\n if (_.isEmpty(currentDocument)) {\n return <h1>{getNotFoundMessage('document')}</h1>;\n }\n\n const {\n title,\n raw_content,\n http_url,\n collection,\n front_matter,\n front_matter_defaults,\n name,\n } = currentDocument;\n const directory = params.splat[0];\n\n const keyboardHandlers = {\n save: this.handleClickSave,\n };\n\n const document_title = getDocumentTitle(collection, directory, title);\n\n return (\n <DocumentTitle title={document_title}>\n <HotKeys handlers={keyboardHandlers} className=\"single\">\n {errors.length > 0 && <Errors errors={errors} />}\n\n <div className=\"content-header\">\n <Breadcrumbs type={collection} splat={directory} />\n </div>\n\n <div className=\"content-wrapper\">\n <MarkdownPageBody\n type={collection}\n path={name}\n title={title}\n body={raw_content}\n updatePath={updatePath}\n updateTitle={updateTitle}\n updateBody={updateBody}\n onSave={this.handleClickSave}\n metafields={{ title, path: name, raw_content, ...front_matter }}\n staticmetafields={front_matter_defaults}\n />\n <div className=\"content-side\">\n <Button\n onClick={this.handleClickSave}\n type=\"save\"\n active={fieldChanged}\n triggered={updated}\n block\n />\n <Button to={http_url} type=\"view\" active block />\n <Splitter />\n <Button\n onClick={this.handleClickDelete}\n type=\"delete\"\n active\n block\n />\n </div>\n </div>\n </HotKeys>\n </DocumentTitle>\n );\n }\n}\n\nDocumentEdit.propTypes = {\n currentDocument: PropTypes.object.isRequired,\n fetchDocument: PropTypes.func.isRequired,\n deleteDocument: PropTypes.func.isRequired,\n putDocument: PropTypes.func.isRequired,\n updateTitle: PropTypes.func.isRequired,\n updateBody: PropTypes.func.isRequired,\n updatePath: PropTypes.func.isRequired,\n clearErrors: PropTypes.func.isRequired,\n isFetching: PropTypes.bool.isRequired,\n errors: PropTypes.array.isRequired,\n updated: PropTypes.bool.isRequired,\n fieldChanged: PropTypes.bool.isRequired,\n params: PropTypes.object.isRequired,\n router: PropTypes.object.isRequired,\n route: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n currentDocument: state.collections.currentDocument,\n isFetching: state.collections.isFetching,\n fieldChanged: state.metadata.fieldChanged,\n updated: state.collections.updated,\n errors: state.utils.errors,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n fetchDocument,\n deleteDocument,\n putDocument,\n updateTitle,\n updateBody,\n updatePath,\n clearErrors,\n },\n dispatch\n );\n\nexport default withRouter(\n connect(mapStateToProps, mapDispatchToProps)(DocumentEdit)\n);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { browserHistory, withRouter } from 'react-router';\nimport DocumentTitle from 'react-document-title';\nimport CreateMarkdownPage from '../../components/CreateMarkdownPage';\nimport { updateTitle, updateBody, updatePath } from '../../ducks/metadata';\nimport { createDocument } from '../../ducks/collections';\nimport { clearErrors } from '../../ducks/utils';\nimport { preventDefault, getDocumentTitle } from '../../utils/helpers';\nimport { ADMIN_PREFIX } from '../../constants';\n\nimport translations from '../../translations';\nconst { getLeaveMessage } = translations;\n\nexport class DocumentNew extends Component {\n componentDidMount() {\n const { router, route } = this.props;\n router.setRouteLeaveHook(route, this.routerWillLeave);\n }\n\n componentWillReceiveProps(nextProps) {\n if (this.props.updated !== nextProps.updated) {\n const path = nextProps.currentDocument.path;\n const splat = path.substr(path.indexOf('/') + 1, path.length);\n browserHistory.push(\n `${ADMIN_PREFIX}/collections/${nextProps.currentDocument.collection}/${splat}`\n );\n }\n }\n\n componentWillUnmount() {\n const { clearErrors, errors } = this.props;\n errors.length && clearErrors();\n }\n\n routerWillLeave = nextLocation => {\n if (this.props.fieldChanged) {\n return getLeaveMessage();\n }\n };\n\n handleClickSave = e => {\n preventDefault(e);\n const { fieldChanged, createDocument, params } = this.props;\n fieldChanged && createDocument(params.collection_name, params.splat);\n };\n\n render() {\n const {\n params,\n config,\n errors,\n updated,\n updateBody,\n updatePath,\n updateTitle,\n fieldChanged,\n } = this.props;\n\n const collection = params.collection_name;\n const title = getDocumentTitle(collection, params.splat, 'New document');\n\n return (\n <DocumentTitle title={title}>\n <CreateMarkdownPage\n type={collection}\n params={params}\n config={config}\n errors={errors}\n updated={updated}\n updateBody={updateBody}\n updatePath={updatePath}\n updateTitle={updateTitle}\n fieldChanged={fieldChanged}\n onClickSave={this.handleClickSave}\n />\n </DocumentTitle>\n );\n }\n}\n\nDocumentNew.propTypes = {\n createDocument: PropTypes.func.isRequired,\n updateTitle: PropTypes.func.isRequired,\n updateBody: PropTypes.func.isRequired,\n updatePath: PropTypes.func.isRequired,\n clearErrors: PropTypes.func.isRequired,\n errors: PropTypes.array.isRequired,\n fieldChanged: PropTypes.bool.isRequired,\n updated: PropTypes.bool.isRequired,\n params: PropTypes.object.isRequired,\n router: PropTypes.object.isRequired,\n route: PropTypes.object.isRequired,\n config: PropTypes.object.isRequired,\n currentDocument: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n currentDocument: state.collections.currentDocument,\n fieldChanged: state.metadata.fieldChanged,\n errors: state.utils.errors,\n updated: state.collections.updated,\n config: state.config.config,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n updateTitle,\n updateBody,\n updatePath,\n createDocument,\n clearErrors,\n },\n dispatch\n );\n\nexport default withRouter(\n connect(mapStateToProps, mapDispatchToProps)(DocumentNew)\n);\n","import { CLEAR_ERRORS, validationError, filterDeleted } from './utils';\nimport { get, put, del } from '../utils/fetch';\nimport { datafilesAPIUrl, datafileAPIUrl } from '../constants/api';\nimport {\n toYAML,\n trimObject,\n computeRelativePath,\n getExtensionFromPath,\n} from '../utils/helpers';\nimport { validator } from '../utils/validation';\n\nimport translations from '../translations';\nconst { getContentRequiredMessage, getFilenameRequiredMessage } = translations;\n\n// Action Types\nexport const FETCH_DATAFILES_REQUEST = 'FETCH_DATAFILES_REQUEST';\nexport const FETCH_DATAFILES_SUCCESS = 'FETCH_DATAFILES_SUCCESS';\nexport const FETCH_DATAFILES_FAILURE = 'FETCH_DATAFILES_FAILURE';\nexport const FETCH_DATAFILE_REQUEST = 'FETCH_DATAFILE_REQUEST';\nexport const FETCH_DATAFILE_SUCCESS = 'FETCH_DATAFILE_SUCCESS';\nexport const FETCH_DATAFILE_FAILURE = 'FETCH_DATAFILE_FAILURE';\nexport const PUT_DATAFILE_REQUEST = 'PUT_DATAFILE_REQUEST';\nexport const PUT_DATAFILE_SUCCESS = 'PUT_DATAFILE_SUCCESS';\nexport const PUT_DATAFILE_FAILURE = 'PUT_DATAFILE_FAILURE';\nexport const DELETE_DATAFILE_REQUEST = 'DELETE_DATAFILE_REQUEST';\nexport const DELETE_DATAFILE_SUCCESS = 'DELETE_DATAFILE_SUCCESS';\nexport const DELETE_DATAFILE_FAILURE = 'DELETE_DATAFILE_FAILURE';\nexport const DATAFILE_CHANGED = 'DATAFILE_CHANGED';\n\n// Actions\nexport const fetchDataFiles = (directory = '') => dispatch => {\n dispatch({ type: FETCH_DATAFILES_REQUEST });\n return get(\n datafilesAPIUrl(directory),\n { type: FETCH_DATAFILES_SUCCESS, name: 'files' },\n { type: FETCH_DATAFILES_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const fetchDataFile = (directory, filename) => dispatch => {\n dispatch({ type: FETCH_DATAFILE_REQUEST });\n return get(\n datafileAPIUrl(directory, filename),\n { type: FETCH_DATAFILE_SUCCESS, name: 'file' },\n { type: FETCH_DATAFILE_FAILURE, name: 'error' },\n dispatch\n );\n};\n\n/**\n * Creates and updates a data file.\n * @param {String} directory : Dirname of data file\n * @param {String} filename : The data file\n * @param {Object} data : Content to be written to data file\n * @param {String} new_path : File path relative to config['source']\n * @param {String} source : Point of origin of file-content data.\n * Either the default `#brace-editor`, or `<DataGUI/>`\n */\nexport const putDataFile = (\n directory,\n filename,\n data,\n new_path = '',\n source = 'editor'\n) => (dispatch, getState) => {\n const ext = getExtensionFromPath(new_path || filename);\n\n if (source === 'gui') {\n const json = /json/i.test(ext);\n let metadata = getState().metadata.metadata;\n metadata = trimObject(metadata);\n data = json ? JSON.stringify(metadata, null, 2) : toYAML(metadata);\n }\n\n const payload = new_path\n ? { path: new_path, raw_content: data }\n : { raw_content: data };\n\n // handle errors\n const errors = validateDatafile(filename, data);\n if (errors.length) {\n return dispatch(validationError(errors));\n }\n dispatch({ type: CLEAR_ERRORS });\n\n return put(\n datafileAPIUrl(directory, filename),\n JSON.stringify(payload),\n { type: PUT_DATAFILE_SUCCESS, name: 'file' },\n { type: PUT_DATAFILE_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const deleteDataFile = (directory, filename) => dispatch => {\n const relative_path = computeRelativePath(directory, filename);\n return del(\n datafileAPIUrl(directory, filename),\n { type: DELETE_DATAFILE_SUCCESS, name: 'file', id: relative_path },\n { type: DELETE_DATAFILE_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const onDataFileChanged = () => ({\n type: DATAFILE_CHANGED,\n});\n\nconst validateDatafile = (filename, data) =>\n validator(\n { filename, data },\n { filename: 'required', data: 'required' },\n {\n 'filename.required': getFilenameRequiredMessage(),\n 'data.required': getContentRequiredMessage(),\n }\n );\n\n// Reducer\nexport default function datafiles(\n state = {\n files: [],\n currentFile: {},\n isFetching: false,\n updated: false,\n datafileChanged: false,\n fieldChanged: false,\n },\n action\n) {\n switch (action.type) {\n case FETCH_DATAFILES_REQUEST:\n case FETCH_DATAFILE_REQUEST:\n return {\n ...state,\n isFetching: true,\n };\n case FETCH_DATAFILES_SUCCESS:\n return {\n ...state,\n files: action.files,\n isFetching: false,\n currentFile: {},\n };\n case FETCH_DATAFILES_FAILURE:\n return {\n ...state,\n isFetching: false,\n currentFile: {},\n };\n case FETCH_DATAFILE_SUCCESS:\n return {\n ...state,\n currentFile: action.file,\n isFetching: false,\n };\n case FETCH_DATAFILE_FAILURE:\n return {\n ...state,\n currentFile: {},\n isFetching: false,\n };\n case PUT_DATAFILE_SUCCESS:\n return {\n ...state,\n currentFile: action.file,\n updated: true,\n datafileChanged: false,\n };\n case PUT_DATAFILE_FAILURE:\n return {\n ...state,\n datafileChanged: false,\n };\n case DELETE_DATAFILE_SUCCESS:\n return {\n ...state,\n files: filterDeleted(state.files, action.id),\n };\n case DATAFILE_CHANGED:\n return {\n ...state,\n datafileChanged: true,\n updated: false,\n };\n default:\n return {\n ...state,\n updated: false,\n datafileChanged: false,\n };\n }\n}\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport DocumentTitle from 'react-document-title';\nimport Explorer from '../../components/Explorer';\nimport { search, filterBySearchInput } from '../../ducks/utils';\nimport { fetchDataFiles, deleteDataFile } from '../../ducks/datafiles';\nimport { getDocumentTitle } from '../../utils/helpers';\n\nexport class DataFiles extends Component {\n componentDidMount() {\n const { fetchDataFiles, params } = this.props;\n fetchDataFiles(params.splat);\n }\n\n componentWillReceiveProps(nextProps) {\n const { fetchDataFiles } = nextProps;\n if (this.props.params.splat !== nextProps.params.splat) {\n fetchDataFiles(nextProps.params.splat);\n }\n }\n\n render() {\n const { isFetching, files, search, params, deleteDataFile } = this.props;\n\n if (isFetching) {\n return null;\n }\n\n const title = getDocumentTitle('data files', params.splat);\n\n return (\n <DocumentTitle title={title}>\n <Explorer\n type=\"datafiles\"\n items={files}\n params={params}\n newBtnLabel=\"New data file\"\n search={search}\n deleteItem={deleteDataFile}\n />\n </DocumentTitle>\n );\n }\n}\n\nDataFiles.propTypes = {\n files: PropTypes.array.isRequired,\n fetchDataFiles: PropTypes.func.isRequired,\n deleteDataFile: PropTypes.func.isRequired,\n isFetching: PropTypes.bool.isRequired,\n search: PropTypes.func.isRequired,\n params: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n files: filterBySearchInput(state.datafiles.files, state.utils.input),\n isFetching: state.datafiles.isFetching,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n fetchDataFiles,\n deleteDataFile,\n search,\n },\n dispatch\n );\n\nexport default connect(mapStateToProps, mapDispatchToProps)(DataFiles);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { browserHistory, withRouter } from 'react-router';\nimport _ from 'underscore';\nimport { HotKeys } from 'react-hotkeys';\nimport DocumentTitle from 'react-document-title';\nimport DataGUI from '../../components/DataGUI';\nimport Breadcrumbs from '../../components/Breadcrumbs';\nimport InputPath from '../../components/form/InputPath';\nimport Splitter from '../../components/Splitter';\nimport Errors from '../../components/Errors';\nimport Editor from '../../components/Editor';\nimport Button from '../../components/Button';\nimport { clearErrors } from '../../ducks/utils';\nimport {\n getFilenameFromPath,\n getExtensionFromPath,\n preventDefault,\n getDocumentTitle,\n} from '../../utils/helpers';\nimport {\n fetchDataFile,\n putDataFile,\n deleteDataFile,\n onDataFileChanged,\n} from '../../ducks/datafiles';\nimport { ADMIN_PREFIX } from '../../constants';\n\nimport translations from '../../translations';\nconst { getLeaveMessage, getDeleteMessage, getNotFoundMessage } = translations;\n\nexport class DataFileEdit extends Component {\n state = {\n guiView: false,\n };\n\n componentDidMount() {\n const { fetchDataFile, params, router, route } = this.props;\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n router.setRouteLeaveHook(route, this.routerWillLeave);\n fetchDataFile(directory, filename);\n }\n\n componentWillReceiveProps(nextProps) {\n if (this.props.updated !== nextProps.updated) {\n const new_path = nextProps.datafile.path;\n const path = this.props.datafile.path;\n\n // redirect if the path is changed\n if (new_path !== path) {\n browserHistory.push(\n `${ADMIN_PREFIX}/datafiles/${nextProps.datafile.relative_path}`\n );\n }\n }\n }\n\n componentWillUnmount() {\n const { clearErrors, errors } = this.props;\n errors.length && clearErrors();\n }\n\n routerWillLeave = nextLocation => {\n const { datafileChanged, fieldChanged } = this.props;\n if (datafileChanged || fieldChanged) {\n return getLeaveMessage();\n }\n };\n\n toggleView = () => {\n this.setState(state => {\n return { guiView: !state.guiView };\n });\n };\n\n handleClickSave = e => {\n preventDefault(e);\n const {\n datafile,\n datafileChanged,\n fieldChanged,\n putDataFile,\n params,\n } = this.props;\n const { path, relative_path } = datafile;\n const data_dir = path.replace(relative_path, '');\n\n let name, data, mode;\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n if (datafileChanged || fieldChanged) {\n if (this.state.guiView) {\n const { filepath, extname } = this.refs.gui.refs;\n name = filepath.value + extname.value;\n data = null;\n mode = 'gui';\n } else {\n const { input } = this.refs.inputpath.refs;\n name = input.value || input.props.defaultValue;\n data = this.refs.editor.getValue();\n mode = 'editor';\n }\n\n const data_path = directory\n ? data_dir + `${directory}/` + name\n : data_dir + name;\n\n const new_path = data_path !== path ? data_path : '';\n putDataFile(directory, filename, data, new_path, mode);\n }\n };\n\n handleClickDelete(path) {\n const { deleteDataFile, params } = this.props;\n const confirm = window.confirm(getDeleteMessage(path));\n\n if (confirm) {\n const directory = params.splat[0];\n const filename = getFilenameFromPath(path);\n deleteDataFile(directory, filename);\n const dir = directory ? `/${directory}` : '';\n browserHistory.push(`${ADMIN_PREFIX}/datafiles${dir}`);\n }\n }\n\n renderAside() {\n const { datafile, datafileChanged, fieldChanged, updated } = this.props;\n const { path } = datafile;\n const filename = getFilenameFromPath(path);\n const ext = getExtensionFromPath(path);\n const guiSupport = /ya?ml|json/i.test(ext);\n\n return (\n <div className=\"content-side\">\n <Button\n onClick={this.handleClickSave}\n type=\"save\"\n active={datafileChanged || fieldChanged}\n triggered={updated}\n block\n />\n {guiSupport && (\n <Button\n onClick={this.toggleView}\n type=\"view-toggle\"\n triggered={this.state.guiView}\n active\n block\n />\n )}\n <Splitter />\n <Button\n onClick={() => this.handleClickDelete(filename)}\n type=\"delete\"\n active\n block\n />\n </div>\n );\n }\n\n renderContentBody(filename) {\n const { datafile, datafileChanged, onDataFileChanged } = this.props;\n const { raw_content, content, slug, ext } = datafile;\n const { guiView } = this.state;\n\n if (guiView && content) {\n return (\n <div className=\"content-body\">\n <DataGUI\n fields={content}\n slug={slug}\n ext={ext}\n onChange={onDataFileChanged}\n ref=\"gui\"\n />\n </div>\n );\n } else if (!guiView && raw_content) {\n return (\n <div className=\"content-body\">\n <InputPath\n onChange={onDataFileChanged}\n type=\"data files\"\n path={filename}\n ref=\"inputpath\"\n />\n <Editor\n editorChanged={datafileChanged}\n onEditorChange={onDataFileChanged}\n content={raw_content}\n type={ext}\n ref=\"editor\"\n />\n </div>\n );\n }\n }\n\n render() {\n const { datafile, isFetching, params, errors } = this.props;\n\n if (isFetching) {\n return null;\n }\n\n if (_.isEmpty(datafile.content)) {\n return <h1>{getNotFoundMessage('content')}</h1>;\n }\n\n const directory = params.splat[0];\n const filename = getFilenameFromPath(datafile.path);\n\n const keyboardHandlers = {\n save: this.handleClickSave,\n };\n\n const document_title = getDocumentTitle('data files', directory, filename);\n\n return (\n <DocumentTitle title={document_title}>\n <HotKeys handlers={keyboardHandlers} className=\"single\">\n {errors.length > 0 && <Errors errors={errors} />}\n\n <div className=\"content-header\">\n <Breadcrumbs type=\"datafiles\" splat={directory} />\n </div>\n\n <div className=\"content-wrapper\">\n {this.renderContentBody(filename)}\n {this.renderAside()}\n </div>\n </HotKeys>\n </DocumentTitle>\n );\n }\n}\n\nDataFileEdit.propTypes = {\n fetchDataFile: PropTypes.func.isRequired,\n putDataFile: PropTypes.func.isRequired,\n deleteDataFile: PropTypes.func.isRequired,\n clearErrors: PropTypes.func.isRequired,\n datafile: PropTypes.object.isRequired,\n onDataFileChanged: PropTypes.func.isRequired,\n isFetching: PropTypes.bool.isRequired,\n updated: PropTypes.bool.isRequired,\n datafileChanged: PropTypes.bool.isRequired,\n fieldChanged: PropTypes.bool.isRequired,\n errors: PropTypes.array.isRequired,\n params: PropTypes.object.isRequired,\n router: PropTypes.object.isRequired,\n route: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n datafile: state.datafiles.currentFile,\n isFetching: state.datafiles.isFetching,\n updated: state.datafiles.updated,\n datafileChanged: state.datafiles.datafileChanged,\n fieldChanged: state.metadata.fieldChanged,\n errors: state.utils.errors,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n fetchDataFile,\n putDataFile,\n deleteDataFile,\n onDataFileChanged,\n clearErrors,\n },\n dispatch\n );\n\nexport default withRouter(\n connect(mapStateToProps, mapDispatchToProps)(DataFileEdit)\n);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { browserHistory, withRouter } from 'react-router';\nimport { HotKeys } from 'react-hotkeys';\nimport DocumentTitle from 'react-document-title';\nimport DataGUI from '../../components/DataGUI';\nimport Errors from '../../components/Errors';\nimport Editor from '../../components/Editor';\nimport Button from '../../components/Button';\nimport Breadcrumbs from '../../components/Breadcrumbs';\nimport InputPath from '../../components/form/InputPath';\nimport { clearErrors } from '../../ducks/utils';\nimport { putDataFile, onDataFileChanged } from '../../ducks/datafiles';\nimport { preventDefault, getDocumentTitle } from '../../utils/helpers';\nimport { ADMIN_PREFIX } from '../../constants';\n\nimport translations from '../../translations';\nconst { getLeaveMessage } = translations;\n\nexport class DataFileNew extends Component {\n state = {\n guiView: false,\n };\n\n componentDidMount() {\n const { router, route } = this.props;\n router.setRouteLeaveHook(route, this.routerWillLeave);\n }\n\n componentWillReceiveProps(nextProps) {\n if (this.props.updated !== nextProps.updated) {\n browserHistory.push(\n `${ADMIN_PREFIX}/datafiles/${nextProps.datafile.relative_path}`\n );\n }\n }\n\n componentWillUnmount() {\n const { clearErrors, errors } = this.props;\n errors.length && clearErrors();\n }\n\n routerWillLeave = nextLocation => {\n if (!this.state.guiView && this.props.datafileChanged) {\n return getLeaveMessage();\n }\n };\n\n toggleView = () => {\n this.setState(state => {\n return { guiView: !state.guiView };\n });\n };\n\n handleClickSave = e => {\n preventDefault(e);\n const { datafileChanged, fieldChanged, putDataFile, params } = this.props;\n let filename;\n\n if (datafileChanged || fieldChanged) {\n if (this.state.guiView) {\n const { filepath, extname } = this.refs.gui.refs;\n filename = filepath.value + extname.value;\n putDataFile(params.splat, filename, null, null, 'gui');\n } else {\n filename = this.refs.inputpath.refs.input.value;\n putDataFile(params.splat, filename, this.refs.editor.getValue());\n }\n }\n };\n\n renderAside() {\n const { datafileChanged, fieldChanged, updated } = this.props;\n\n return (\n <div className=\"content-side\">\n <Button\n onClick={this.handleClickSave}\n type=\"create\"\n active={datafileChanged || fieldChanged}\n triggered={updated}\n block\n />\n <Button\n onClick={this.toggleView}\n type=\"view-toggle\"\n triggered={this.state.guiView}\n active\n block\n />\n </div>\n );\n }\n\n renderContentBody() {\n const { datafileChanged, onDataFileChanged } = this.props;\n\n if (this.state.guiView) {\n return (\n <div className=\"content-body\">\n <DataGUI onChange={onDataFileChanged} ref=\"gui\" />\n </div>\n );\n }\n\n return (\n <div className=\"content-body\">\n <InputPath\n onChange={onDataFileChanged}\n type=\"data files\"\n path=\"\"\n ref=\"inputpath\"\n />\n <Editor\n editorChanged={datafileChanged}\n onEditorChange={onDataFileChanged}\n content=\"\"\n ref=\"editor\"\n />\n </div>\n );\n }\n\n render() {\n const { errors, params } = this.props;\n\n const keyboardHandlers = {\n save: this.handleClickSave,\n };\n\n const title = getDocumentTitle('data files', params.splat, 'New data file');\n\n return (\n <DocumentTitle title={title}>\n <HotKeys handlers={keyboardHandlers}>\n {errors.length > 0 && <Errors errors={errors} />}\n\n <div className=\"content-header\">\n <Breadcrumbs type=\"datafiles\" splat={params.splat} />\n </div>\n\n <div className=\"content-wrapper\">\n {this.renderContentBody()}\n {this.renderAside()}\n </div>\n </HotKeys>\n </DocumentTitle>\n );\n }\n}\n\nDataFileNew.propTypes = {\n putDataFile: PropTypes.func.isRequired,\n datafile: PropTypes.object.isRequired,\n onDataFileChanged: PropTypes.func.isRequired,\n clearErrors: PropTypes.func.isRequired,\n errors: PropTypes.array.isRequired,\n updated: PropTypes.bool.isRequired,\n datafileChanged: PropTypes.bool.isRequired,\n router: PropTypes.object.isRequired,\n route: PropTypes.object.isRequired,\n params: PropTypes.object.isRequired,\n fieldChanged: PropTypes.bool,\n};\n\nconst mapStateToProps = state => ({\n datafile: state.datafiles.currentFile,\n updated: state.datafiles.updated,\n datafileChanged: state.datafiles.datafileChanged,\n fieldChanged: state.metadata.fieldChanged,\n errors: state.utils.errors,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n putDataFile,\n onDataFileChanged,\n clearErrors,\n },\n dispatch\n );\n\nexport default withRouter(\n connect(mapStateToProps, mapDispatchToProps)(DataFileNew)\n);\n","import _ from 'underscore';\nimport { CLEAR_ERRORS, validationError, filterDeleted } from './utils';\nimport { PUT_DOCUMENT_SUCCESS, PUT_DOCUMENT_FAILURE } from './collections';\nimport { get, put, del } from '../utils/fetch';\nimport { validator } from '../utils/validation';\nimport { slugify, trimObject, computeRelativePath } from '../utils/helpers';\nimport { draftsAPIUrl, draftAPIUrl, documentAPIUrl } from '../constants/api';\n\nimport translations from '../translations';\nconst { getTitleRequiredMessage, getFilenameNotValidMessage } = translations;\n\nexport const FETCH_DRAFTS_REQUEST = 'FETCH_DRAFTS_REQUEST';\nexport const FETCH_DRAFTS_SUCCESS = 'FETCH_DRAFTS_SUCCESS';\nexport const FETCH_DRAFTS_FAILURE = 'FETCH_DRAFTS_FAILURE';\n\nexport const FETCH_DRAFT_REQUEST = 'FETCH_DRAFT_REQUEST';\nexport const FETCH_DRAFT_SUCCESS = 'FETCH_DRAFT_SUCCESS';\nexport const FETCH_DRAFT_FAILURE = 'FETCH_DRAFT_FAILURE';\n\nexport const PUT_DRAFT_REQUEST = 'PUT_DRAFT_REQUEST';\nexport const PUT_DRAFT_SUCCESS = 'PUT_DRAFT_SUCCESS';\nexport const PUT_DRAFT_FAILURE = 'PUT_DRAFT_FAILURE';\n\nexport const DELETE_DRAFT_REQUEST = 'DELETE_DRAFT_REQUEST';\nexport const DELETE_DRAFT_SUCCESS = 'DELETE_DRAFT_SUCCESS';\nexport const DELETE_DRAFT_FAILURE = 'DELETE_DRAFT_FAILURE';\n\nexport const fetchDrafts = (directory = '') => dispatch => {\n dispatch({ type: FETCH_DRAFTS_REQUEST });\n return get(\n draftsAPIUrl(directory),\n { type: FETCH_DRAFTS_SUCCESS, name: 'drafts' },\n { type: FETCH_DRAFTS_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const fetchDraft = (directory, filename) => dispatch => {\n dispatch({ type: FETCH_DRAFT_REQUEST });\n return get(\n draftAPIUrl(directory, filename),\n { type: FETCH_DRAFT_SUCCESS, name: 'draft' },\n { type: FETCH_DRAFT_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const putDraft = (mode, directory, filename = '') => (\n dispatch,\n getState\n) => {\n // get edited fields from metadata state\n const metadata = getState().metadata.metadata;\n let { path, raw_content, title } = metadata;\n\n // if path is not given or equals to directory, generate filename from the title\n if (!path && title) {\n path = `${slugify(title)}.md`;\n } else if (!path && !title) {\n return dispatch(validationError(validateDraft(metadata)));\n }\n // clear errors\n dispatch({ type: CLEAR_ERRORS });\n\n // omit raw_content, path and empty-value keys in metadata state from front_matter\n const front_matter = _.omit(metadata, (value, key, object) => {\n return key === 'raw_content' || key === 'path' || value === '';\n });\n\n let payload;\n if (mode === 'create') {\n // strip '_drafts/' from path when provided\n filename = path.replace('_drafts/', '');\n payload = { front_matter, raw_content };\n } else {\n let writePath = directory\n ? `_drafts/${directory}/${path}`\n : `_drafts/${path}`;\n payload = { path: writePath, front_matter, raw_content };\n }\n\n //send the put request\n return put(\n draftAPIUrl(directory, filename),\n preparePayload(payload),\n { type: PUT_DRAFT_SUCCESS, name: 'draft' },\n { type: PUT_DRAFT_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const deleteDraft = (directory, filename) => dispatch => {\n const relative_path = computeRelativePath(directory, filename);\n return del(\n draftAPIUrl(directory, filename),\n { type: DELETE_DRAFT_SUCCESS, name: 'draft', id: relative_path },\n { type: DELETE_DRAFT_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nexport const publishDraft = (directory, filename) => (dispatch, getState) => {\n const metadata = getState().metadata.metadata;\n const { raw_content } = metadata;\n\n // omit raw_content, path and empty-value keys in metadata state from front_matter\n const front_matter = _.omit(metadata, (value, key, object) => {\n return key === 'raw_content' || key === 'path' || value === '';\n });\n\n return put(\n documentAPIUrl('posts', directory, filename),\n preparePayload({ raw_content, front_matter }),\n { type: PUT_DOCUMENT_SUCCESS, name: 'doc' },\n { type: PUT_DOCUMENT_FAILURE, name: 'error' },\n dispatch\n );\n};\n\nconst validateDraft = metadata =>\n validator(\n metadata,\n { path: 'required|filename' },\n {\n 'path.required': getTitleRequiredMessage(),\n 'path.filename': getFilenameNotValidMessage(),\n }\n );\n\nconst preparePayload = obj => JSON.stringify(trimObject(obj));\n\nexport default function drafts(\n state = {\n drafts: [],\n draft: {},\n isFetching: false,\n updated: false,\n },\n action\n) {\n switch (action.type) {\n case FETCH_DRAFTS_REQUEST:\n case FETCH_DRAFT_REQUEST:\n return {\n ...state,\n isFetching: true,\n };\n case FETCH_DRAFTS_SUCCESS:\n return {\n ...state,\n drafts: action.drafts,\n isFetching: false,\n draft: {},\n };\n case FETCH_DRAFTS_FAILURE:\n return {\n ...state,\n isFetching: false,\n drafts: [],\n };\n case FETCH_DRAFT_SUCCESS:\n return {\n ...state,\n draft: action.draft,\n isFetching: false,\n };\n case FETCH_DRAFT_FAILURE:\n return {\n ...state,\n draft: {},\n isFetching: false,\n };\n case PUT_DRAFT_SUCCESS:\n return {\n ...state,\n draft: action.draft,\n updated: true,\n };\n case DELETE_DRAFT_SUCCESS:\n return {\n ...state,\n drafts: filterDeleted(state.drafts, action.id),\n };\n default:\n return {\n ...state,\n updated: false,\n };\n }\n}\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport DocumentTitle from 'react-document-title';\nimport Explorer from '../../components/Explorer';\nimport { search, filterBySearchInput } from '../../ducks/utils';\nimport { fetchDrafts, deleteDraft } from '../../ducks/drafts';\nimport { getDocumentTitle } from '../../utils/helpers';\n\nexport class Drafts extends Component {\n componentDidMount() {\n const { fetchDrafts, params } = this.props;\n fetchDrafts(params.splat);\n }\n\n componentWillReceiveProps(nextProps) {\n const { fetchDrafts } = nextProps;\n if (this.props.params.splat !== nextProps.params.splat) {\n fetchDrafts(nextProps.params.splat);\n }\n }\n\n render() {\n const { isFetching, drafts, search, params, deleteDraft } = this.props;\n\n if (isFetching) {\n return null;\n }\n\n const title = getDocumentTitle('drafts', params.splat);\n\n return (\n <DocumentTitle title={title}>\n <Explorer\n type=\"drafts\"\n items={drafts}\n params={params}\n newBtnLabel=\"New draft\"\n search={search}\n deleteItem={deleteDraft}\n />\n </DocumentTitle>\n );\n }\n}\n\nDrafts.propTypes = {\n drafts: PropTypes.array.isRequired,\n fetchDrafts: PropTypes.func.isRequired,\n deleteDraft: PropTypes.func.isRequired,\n isFetching: PropTypes.bool.isRequired,\n search: PropTypes.func.isRequired,\n params: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n drafts: filterBySearchInput(state.drafts.drafts, state.utils.input),\n isFetching: state.drafts.isFetching,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n fetchDrafts,\n deleteDraft,\n search,\n },\n dispatch\n );\n\nexport default connect(mapStateToProps, mapDispatchToProps)(Drafts);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { browserHistory, withRouter } from 'react-router';\nimport { HotKeys } from 'react-hotkeys';\nimport _ from 'underscore';\nimport moment from 'moment';\nimport DocumentTitle from 'react-document-title';\nimport Button from '../../components/Button';\nimport Errors from '../../components/Errors';\nimport Splitter from '../../components/Splitter';\nimport Breadcrumbs from '../../components/Breadcrumbs';\nimport MarkdownPageBody from '../../components/MarkdownPageBody';\nimport {\n fetchDraft,\n deleteDraft,\n putDraft,\n publishDraft,\n} from '../../ducks/drafts';\nimport { updateTitle, updateBody, updatePath } from '../../ducks/metadata';\nimport { clearErrors } from '../../ducks/utils';\nimport { preventDefault, getDocumentTitle } from '../../utils/helpers';\nimport { ADMIN_PREFIX } from '../../constants';\n\nimport translations from '../../translations';\nconst {\n getLeaveMessage,\n getDeleteMessage,\n getPublishDraftMessage,\n} = translations;\n\nexport class DraftEdit extends Component {\n componentDidMount() {\n const { fetchDraft, params, router, route } = this.props;\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n fetchDraft(directory, filename);\n\n router.setRouteLeaveHook(route, this.routerWillLeave);\n }\n\n componentWillReceiveProps(nextProps) {\n if (this.props.updated !== nextProps.updated) {\n const new_path = nextProps.draft.path;\n const path = this.props.draft.path;\n // redirect if the path is changed\n if (new_path !== path) {\n browserHistory.push(\n `${ADMIN_PREFIX}/drafts/${nextProps.draft.relative_path}`\n );\n }\n }\n }\n\n componentWillUnmount() {\n const { clearErrors, errors } = this.props;\n errors.length && clearErrors();\n }\n\n routerWillLeave = nextLocation => {\n if (this.props.fieldChanged) {\n return getLeaveMessage();\n }\n };\n\n handleClickSave = e => {\n preventDefault(e);\n const { putDraft, fieldChanged, params } = this.props;\n if (fieldChanged) {\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n putDraft('edit', directory, filename);\n }\n };\n\n handleClickPublish(path) {\n const { deleteDraft, publishDraft, params } = this.props;\n\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n const today = moment().format('YYYY-MM-DD');\n const datedfilename = `${today}-${filename}`;\n const postPath = directory\n ? `_posts/${directory}/${datedfilename}`\n : `_posts/${datedfilename}`;\n\n const confirm = window.confirm(getPublishDraftMessage(path, postPath));\n if (confirm) {\n const goTo = directory ? `/${directory}` : '';\n deleteDraft(directory, filename);\n publishDraft(directory, datedfilename);\n browserHistory.push(`${ADMIN_PREFIX}/drafts${goTo}`);\n }\n }\n\n handleClickDelete(name) {\n const { deleteDraft, params } = this.props;\n const confirm = window.confirm(getDeleteMessage(name));\n if (confirm) {\n const [directory, ...rest] = params.splat;\n const filename = rest.join('.');\n const goTo = directory ? `/${directory}` : '';\n deleteDraft(directory, filename);\n browserHistory.push(`${ADMIN_PREFIX}/drafts${goTo}`);\n }\n }\n\n render() {\n const {\n isFetching,\n draft,\n errors,\n updateTitle,\n updateBody,\n updatePath,\n updated,\n fieldChanged,\n params,\n } = this.props;\n\n if (isFetching) {\n return null;\n } else if (_.isEmpty(draft)) {\n return <h1>Could not find the draft.</h1>;\n }\n\n const keyboardHandlers = {\n save: this.handleClickSave,\n };\n\n const {\n name,\n path,\n raw_content,\n http_url,\n front_matter,\n front_matter_defaults,\n } = draft;\n const directory = params.splat[0];\n const title = front_matter && front_matter.title ? front_matter.title : '';\n const document_title = getDocumentTitle('drafts', directory, title || name);\n\n return (\n <DocumentTitle title={document_title}>\n <HotKeys handlers={keyboardHandlers} className=\"single\">\n {errors.length > 0 && <Errors errors={errors} />}\n <div className=\"content-header\">\n <Breadcrumbs type=\"drafts\" splat={directory} />\n </div>\n\n <div className=\"content-wrapper\">\n <MarkdownPageBody\n type=\"drafts\"\n path={name}\n title={title}\n body={raw_content}\n updatePath={updatePath}\n updateBody={updateBody}\n updateTitle={updateTitle}\n onSave={this.handleClickSave}\n metafields={{ title, raw_content, path: name, ...front_matter }}\n staticmetafields={front_matter_defaults}\n />\n <div className=\"content-side\">\n <Button\n onClick={this.handleClickSave}\n type=\"save\"\n active={fieldChanged}\n triggered={updated}\n block\n />\n <Button to={http_url} type=\"view\" active block />\n <Splitter />\n <Button\n onClick={() => this.handleClickPublish(path)}\n type=\"publish\"\n active\n block\n />\n <Button\n onClick={() => this.handleClickDelete(name)}\n type=\"delete\"\n active\n block\n />\n </div>\n </div>\n </HotKeys>\n </DocumentTitle>\n );\n }\n}\n\nDraftEdit.propTypes = {\n draft: PropTypes.object.isRequired,\n fetchDraft: PropTypes.func.isRequired,\n deleteDraft: PropTypes.func.isRequired,\n putDraft: PropTypes.func.isRequired,\n updateTitle: PropTypes.func.isRequired,\n updateBody: PropTypes.func.isRequired,\n updatePath: PropTypes.func.isRequired,\n clearErrors: PropTypes.func.isRequired,\n publishDraft: PropTypes.func.isRequired,\n isFetching: PropTypes.bool.isRequired,\n errors: PropTypes.array.isRequired,\n fieldChanged: PropTypes.bool.isRequired,\n updated: PropTypes.bool.isRequired,\n params: PropTypes.object.isRequired,\n router: PropTypes.object.isRequired,\n route: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n draft: state.drafts.draft,\n isFetching: state.drafts.isFetching,\n fieldChanged: state.metadata.fieldChanged,\n updated: state.drafts.updated,\n errors: state.utils.errors,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n fetchDraft,\n deleteDraft,\n putDraft,\n publishDraft,\n updateTitle,\n updateBody,\n updatePath,\n clearErrors,\n },\n dispatch\n );\n\nexport default withRouter(\n connect(mapStateToProps, mapDispatchToProps)(DraftEdit)\n);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport { browserHistory, withRouter } from 'react-router';\nimport DocumentTitle from 'react-document-title';\nimport CreateMarkdownPage from '../../components/CreateMarkdownPage';\nimport { updateTitle, updateBody, updatePath } from '../../ducks/metadata';\nimport { putDraft } from '../../ducks/drafts';\nimport { clearErrors } from '../../ducks/utils';\nimport { preventDefault, getDocumentTitle } from '../../utils/helpers';\nimport { ADMIN_PREFIX } from '../../constants';\n\nimport translations from '../../translations';\nconst { getLeaveMessage } = translations;\n\nexport class DraftNew extends Component {\n componentDidMount() {\n const { router, route } = this.props;\n router.setRouteLeaveHook(route, this.routerWillLeave);\n }\n\n componentWillReceiveProps(nextProps) {\n if (this.props.updated !== nextProps.updated) {\n browserHistory.push(\n `${ADMIN_PREFIX}/drafts/${nextProps.draft.relative_path}`\n );\n }\n }\n\n componentWillUnmount() {\n const { clearErrors, errors } = this.props;\n errors.length && clearErrors();\n }\n\n routerWillLeave = nextLocation => {\n if (this.props.fieldChanged) {\n return getLeaveMessage();\n }\n };\n\n handleClickSave = e => {\n preventDefault(e);\n const { fieldChanged, putDraft, params } = this.props;\n fieldChanged && putDraft('create', params.splat);\n };\n\n render() {\n const {\n params,\n config,\n errors,\n updated,\n updateBody,\n updatePath,\n updateTitle,\n fieldChanged,\n } = this.props;\n\n const title = getDocumentTitle('drafts', params.splat, 'New draft');\n\n return (\n <DocumentTitle title={title}>\n <CreateMarkdownPage\n type=\"drafts\"\n params={params}\n config={config}\n errors={errors}\n updated={updated}\n updateBody={updateBody}\n updatePath={updatePath}\n updateTitle={updateTitle}\n fieldChanged={fieldChanged}\n onClickSave={this.handleClickSave}\n />\n </DocumentTitle>\n );\n }\n}\n\nDraftNew.propTypes = {\n putDraft: PropTypes.func.isRequired,\n updateTitle: PropTypes.func.isRequired,\n updateBody: PropTypes.func.isRequired,\n updatePath: PropTypes.func.isRequired,\n clearErrors: PropTypes.func.isRequired,\n errors: PropTypes.array.isRequired,\n fieldChanged: PropTypes.bool.isRequired,\n updated: PropTypes.bool.isRequired,\n router: PropTypes.object.isRequired,\n route: PropTypes.object.isRequired,\n params: PropTypes.object.isRequired,\n config: PropTypes.object.isRequired,\n draft: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n draft: state.drafts.draft,\n fieldChanged: state.metadata.fieldChanged,\n errors: state.utils.errors,\n updated: state.drafts.updated,\n config: state.config.config,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n updateTitle,\n updateBody,\n updatePath,\n putDraft,\n clearErrors,\n },\n dispatch\n );\n\nexport default withRouter(\n connect(mapStateToProps, mapDispatchToProps)(DraftNew)\n);\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport _ from 'underscore';\nimport ReactDropzone from 'react-dropzone';\nimport FilePreview from './FilePreview';\nimport Splitter from './Splitter';\nimport Icon from './Icon';\n\nexport class Dropzone extends Component {\n openDropzone() {\n this.refs.ReactDropzone.open();\n }\n\n render() {\n const { files, splat, onDrop, onClickDelete, onClickItem } = this.props;\n return (\n <ReactDropzone\n onDrop={onDrop}\n ref=\"ReactDropzone\"\n className=\"dropzone\"\n activeClassName=\"dropzone-active\"\n multiple\n disableClick\n >\n {files.length ? (\n <div className=\"preview-container\">\n {_.map(files, (file, i) => (\n <FilePreview\n key={i}\n onClick={onClickItem}\n onClickDelete={onClickDelete}\n splat={splat}\n file={file}\n />\n ))}\n <Splitter />\n <div className=\"preview-tip\">\n <div>Drag and drop file(s) here to upload</div>\n </div>\n </div>\n ) : (\n <div className=\"preview-info\">\n <Icon name=\"upload\" />\n <p>Drag and drop file(s) here to upload</p>\n </div>\n )}\n </ReactDropzone>\n );\n }\n}\n\nDropzone.propTypes = {\n files: PropTypes.array.isRequired,\n splat: PropTypes.string.isRequired,\n onDrop: PropTypes.func.isRequired,\n onClickDelete: PropTypes.func.isRequired,\n onClickItem: PropTypes.func,\n};\n\nexport default Dropzone;\n","import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { Link } from 'react-router';\nimport { connect } from 'react-redux';\nimport { bindActionCreators } from 'redux';\nimport DocumentTitle from 'react-document-title';\nimport Dropzone from '../../components/Dropzone';\nimport Button from '../../components/Button';\nimport Icon from '../../components/Icon';\nimport Breadcrumbs from '../../components/Breadcrumbs';\nimport InputSearch from '../../components/form/InputSearch';\nimport { search } from '../../ducks/utils';\nimport {\n existingUploadedFilenames,\n getDocumentTitle,\n} from '../../utils/helpers';\nimport {\n fetchStaticFiles,\n uploadStaticFiles,\n deleteStaticFile,\n filterByFilename,\n} from '../../ducks/staticfiles';\nimport { ADMIN_PREFIX } from '../../constants';\n\nimport translations from '../../translations';\nconst { getOverrideMessage } = translations;\n\nexport class StaticFiles extends Component {\n componentDidMount() {\n const { fetchStaticFiles, params } = this.props;\n fetchStaticFiles(params.splat);\n }\n\n componentWillReceiveProps(nextProps) {\n const { fetchStaticFiles } = nextProps;\n if (this.props.params.splat !== nextProps.params.splat) {\n fetchStaticFiles(nextProps.params.splat);\n }\n }\n\n onDrop(uploadedFiles) {\n const { uploadStaticFiles, files, params } = this.props;\n const existingFiles = existingUploadedFilenames(uploadedFiles, files);\n if (existingFiles.length > 0) {\n const confirm = window.confirm(\n getOverrideMessage(existingFiles.join(', '))\n );\n if (!confirm) {\n return false;\n }\n }\n uploadStaticFiles(params.splat, uploadedFiles);\n }\n\n openDropzone = () => {\n this.refs.dropzone.openDropzone();\n };\n\n renderFilePreviewRow(static_files, key) {\n const { params, onClickStaticFile, deleteStaticFile } = this.props;\n return (\n <tr key={key}>\n <td>\n <Dropzone\n ref=\"dropzone\"\n splat={params.splat || ''}\n files={static_files}\n onClickItem={onClickStaticFile}\n onClickDelete={deleteStaticFile}\n onDrop={static_files => this.onDrop(static_files)}\n />\n </td>\n </tr>\n );\n }\n\n renderDirectoryRow(directory, index) {\n const { name, path } = directory;\n const to = `${ADMIN_PREFIX}/staticfiles/${path}`;\n return (\n <tr key={index}>\n <td className=\"row-title\">\n <strong>\n <Link to={to}>\n <Icon name=\"folder\" />\n {name}\n </Link>\n </strong>\n </td>\n </tr>\n );\n }\n\n renderRows() {\n const { files } = this.props;\n const dirs = files.filter(entity => entity.type === 'directory');\n const static_files = files.filter(entity => !entity.type);\n\n return dirs\n .map((entry, index) => this.renderDirectoryRow(entry, index))\n .concat(this.renderFilePreviewRow(static_files, dirs.length + 1));\n }\n\n renderTable() {\n return (\n <div className=\"content-table\">\n <table>\n <thead>\n <tr>\n <th>Directory Contents</th>\n </tr>\n </thead>\n <tbody>{this.renderRows()}</tbody>\n </table>\n </div>\n );\n }\n\n render() {\n const { isFetching, params, search } = this.props;\n\n if (isFetching) {\n return null;\n }\n\n const to = `${ADMIN_PREFIX}/staticfiles/index`;\n const title = getDocumentTitle('static files', params.splat);\n\n return (\n <DocumentTitle title={title}>\n <div>\n <div className=\"content-header\">\n <Breadcrumbs type=\"staticfiles\" splat={params.splat} />\n <div className=\"page-buttons multiple\">\n <Link className=\"btn btn-view\" to={to}>\n Index Listing\n </Link>\n <Button\n onClick={() => this.openDropzone()}\n type=\"upload\"\n active\n />\n </div>\n <div className=\"pull-right\">\n <InputSearch searchBy=\"filename\" search={search} />\n </div>\n </div>\n {this.renderTable()}\n </div>\n </DocumentTitle>\n );\n }\n}\n\nStaticFiles.propTypes = {\n files: PropTypes.array.isRequired,\n isFetching: PropTypes.bool.isRequired,\n fetchStaticFiles: PropTypes.func.isRequired,\n uploadStaticFiles: PropTypes.func.isRequired,\n deleteStaticFile: PropTypes.func.isRequired,\n onClickStaticFile: PropTypes.func,\n search: PropTypes.func.isRequired,\n params: PropTypes.object.isRequired,\n};\n\nconst mapStateToProps = state => ({\n files: filterByFilename(state.staticfiles.files, state.utils.input),\n isFetching: state.staticfiles.isFetching,\n});\n\nconst mapDispatchToProps = dispatch =>\n bindActionCreators(\n {\n fetchStaticFiles,\n uploadStaticFiles,\n deleteStaticFile,\n search,\n },\n dispatch\n );\n\nexport default connect(mapStateToProps, mapDispatchToProps)(StaticFiles);\n","import React from 'react';\n\nconst NotFound = () => (\n <div className=\"notfound\">\n <img src={require('../../assets/images/logo-black-red.png')} alt=\"Jekyll Admin\" />\n <h1>Huh. It seems that page is Hyde-ing...</h1>\n <h2>The resource you requested was not found.</h2>\n </div>\n);\n\nexport default NotFound;\n","import React from 'react';\nimport { Route, IndexRoute } from 'react-router';\nimport { ADMIN_PREFIX } from './constants';\n\nimport App from './containers/App';\nimport Configuration from './containers/views/Configuration';\nimport Pages from './containers/views/Pages';\nimport PageEdit from './containers/views/PageEdit';\nimport PageNew from './containers/views/PageNew';\nimport Documents from './containers/views/Documents';\nimport DocumentEdit from './containers/views/DocumentEdit';\nimport DocumentNew from './containers/views/DocumentNew';\nimport DataFiles from './containers/views/DataFiles';\nimport DataFileEdit from './containers/views/DataFileEdit';\nimport DataFileNew from './containers/views/DataFileNew';\nimport Drafts from './containers/views/Drafts';\nimport DraftEdit from './containers/views/DraftEdit';\nimport DraftNew from './containers/views/DraftNew';\nimport StaticFiles from './containers/views/StaticFiles';\nimport StaticIndex from './containers/views/StaticIndex';\nimport NotFound from './containers/views/NotFound';\n\nexport default (\n <Route path={`${ADMIN_PREFIX}`} component={App}>\n <IndexRoute component={Pages} />\n <Route path=\"configuration\" component={Configuration} />\n <Route path=\"pages\">\n <IndexRoute component={Pages} />\n <Route path=\"(**/)new\" component={PageNew} />\n <Route path=\"(**/)*.*\" component={PageEdit} />\n <Route path=\"**\" component={Pages} />\n </Route>\n <Route path=\"collections\">\n <Route path=\":collection_name\">\n <IndexRoute component={Documents} />\n <Route path=\"(**/)new\" component={DocumentNew} />\n <Route path=\"(**/)*.*\" component={DocumentEdit} />\n <Route path=\"**\" component={Documents} />\n </Route>\n </Route>\n <Route path=\"drafts\">\n <IndexRoute component={Drafts} />\n <Route path=\"(**/)new\" component={DraftNew} />\n <Route path=\"(**/)*.*\" component={DraftEdit} />\n <Route path=\"**\" component={Drafts} />\n </Route>\n <Route path=\"datafiles\">\n <IndexRoute component={DataFiles} />\n <Route path=\"(**/)new\" component={DataFileNew} />\n <Route path=\"(**/)*.*\" component={DataFileEdit} />\n <Route path=\"**\" component={DataFiles} />\n </Route>\n <Route path=\"staticfiles\">\n <IndexRoute component={StaticFiles} />\n <Route path=\"index\" component={StaticIndex} />\n <Route path=\"**\" component={StaticFiles} />\n </Route>\n <Route path={`${ADMIN_PREFIX}/*`} component={NotFound} />\n </Route>\n);\n","import { combineReducers } from 'redux';\nimport { routerReducer } from 'react-router-redux';\n\nimport config from './config';\nimport pages from './pages';\nimport collections from './collections';\nimport metadata from './metadata';\nimport drafts from './drafts';\nimport datafiles from './datafiles';\nimport staticfiles from './staticfiles';\nimport utils from './utils';\nimport siteMeta from './siteMeta';\nimport notifications from './notifications';\n\nexport default combineReducers({\n routing: routerReducer,\n meta: siteMeta,\n config,\n pages,\n collections,\n metadata,\n drafts,\n datafiles,\n staticfiles,\n utils,\n notifications,\n});\n","import { createStore, compose, applyMiddleware } from 'redux';\nimport reduxImmutableStateInvariant from 'redux-immutable-state-invariant';\nimport thunk from 'redux-thunk';\nimport createLogger from 'redux-logger';\nimport rootReducer from './ducks';\n\nconst logger = createLogger();\n\nconst configureStoreProd = initialState => {\n const middlewares = [thunk];\n\n return createStore(\n rootReducer,\n initialState,\n compose(applyMiddleware(...middlewares))\n );\n};\n\nconst configureStoreDev = initialState => {\n const middlewares = [reduxImmutableStateInvariant(), thunk, logger];\n\n const composeEnhancers =\n window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;\n const store = createStore(\n rootReducer,\n initialState,\n composeEnhancers(applyMiddleware(...middlewares))\n );\n\n if (module.hot) {\n module.hot.accept('./ducks', () => {\n const nextReducer = require('./ducks').default;\n store.replaceReducer(nextReducer);\n });\n }\n\n return store;\n};\n\nconst configureStore =\n process.env.NODE_ENV === 'production'\n ? configureStoreProd\n : configureStoreDev;\n\nexport default configureStore;\n","/* eslint-disable import/default */\nimport React from 'react';\nimport { syncHistoryWithStore } from 'react-router-redux';\nimport { render } from 'react-dom';\nimport { Provider } from 'react-redux';\nimport { Router, browserHistory, Redirect } from 'react-router';\nimport routes from './routes';\nimport configureStore from './store';\nimport { ADMIN_PREFIX } from './constants';\nimport './styles/main.scss';\n\nconst store = configureStore();\nconst history = syncHistoryWithStore(browserHistory, store);\n\nrender(\n <Provider store={store}>\n <Router history={history} routes={routes}>\n <Redirect from={`${ADMIN_PREFIX}/`} to={`${ADMIN_PREFIX}/pages/`} />\n </Router>\n </Provider>,\n document.getElementById('root')\n);\n"],"sourceRoot":""}