Skip to content

Commit 9bbfc57

Browse files
committed
Adding the proper ProcessWire site profile
1 parent 39c84ac commit 9bbfc57

Some content is hidden

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

76 files changed

+3413
-0
lines changed

README.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<img width="350" src="https://raw.githubusercontent.com/microcipcip/processvue/master/templates/client/src/assets/logo.png">
2+
3+
# ProcessWire Site Profile for Vue 2.0
4+
5+
ProcessVue is a boilerplate for getting started with ProcessWire 3.0 as a headless CMS for Vue 2.0 SPAs.
6+
7+
## Features:
8+
9+
- REST API
10+
- Fetch title fields
11+
- Fetch textearea fields
12+
- Fetch image/gallery fields (included resizing)
13+
- Fetch repeater fields
14+
- Fetch children pages
15+
- Vue Webpack boilerplate
16+
- Vue Router
17+
- Vue Meta (to update metatags)
18+
- Vuex (store management)
19+
20+
## To Install site profile
21+
22+
Grab a copy of the latest ProcessWire. Copy or upload the /site-processvue/ directory and everything in it to the root of your ProcessWire files. This is the same directory that ProcessWire's index.php and /site-default/ directories live. So you'll have a /site-processvue/ alongside ProcessWire's /site-default/ and any other profiles it comes with.
23+
24+
Load the URL to your ProcessWire installation in your browser to initiate the installer. Select the "ProcessVue" profile from the dropdown when prompted to do so. The installer will take care of the rest.
25+
26+
## To Install npm packages
27+
28+
1. Update `site/templates/client/config/index.js` proxyTable with the right domain name
29+
2. Install npm packages from `site/templates/client` by running `npm i`
30+
3. Run webpack dev server by running `npm run dev`, or compile all assets with `npm run build`
31+
32+
## Note
33+
34+
If your website is in localhost (for example http://localhost/processvue) and not in a virtual server (i.e. http://processvue.localdev), with the command `npm run build` the website may not be visible because the js files point to the wrong path, so you may need a proper virtual server to browse the site correctly.
35+
36+
The `npm run dev` command should work fine without setting up a virtual server.

site-processvue/assets/index.php

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
// Intentionally left blank to test that htaccess rewrite rules are working.
3+
// Accessing this file from http should produce a '403 forbidden' error,
4+
// since all PHP files are blocked under /assets/.

site-processvue/config.php

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/**
4+
* ProcessWire Configuration File
5+
*
6+
* Site-specific configuration for ProcessWire.
7+
* This config.php file was generated by the ProcessExportProfile module.
8+
*
9+
* Please see the file /wire/config.php which contains all configuration options you may
10+
* specify here. Simply copy any of the configuration options from that file and paste
11+
* them into this file in order to modify them.
12+
*
13+
* ProcessWire
14+
* Copyright (C) 2017 by Ryan Cramer
15+
* Licensed under MPL 2.0
16+
*
17+
* https://processwire.com
18+
*
19+
*/
20+
21+
if(!defined("PROCESSWIRE")) die();
22+
23+
/*** SITE CONFIG *************************************************************************/
24+
25+
/**
26+
* Enable debug mode?
27+
*
28+
* Debug mode causes additional info to appear for use during dev and debugging.
29+
* This is almost always recommended for sites in development. However, you should
30+
* always have this disabled for live/production sites.
31+
*
32+
* @var bool
33+
*
34+
*/
35+
$config->debug = false;
36+
37+
38+
39+
/*** INSTALLER CONFIG ********************************************************************/
40+
41+
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This file is here to ensure Git adds the dir to the repo. You may delete this file.

site-processvue/install/info.php

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php if(!defined("PROCESSWIRE_INSTALL")) die();
2+
$info = array(
3+
'title' => "ProcessVue",
4+
'summary' => "ProcessVue is a boilerplate for getting started with ProcessWire as a headless CMS for VueJS SPAs",
5+
'screenshot' => "screenshot.jpg"
6+
);

site-processvue/install/install.sql

+596
Large diffs are not rendered by default.
112 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?php namespace ProcessWire;
2+
3+
/**
4+
* ProcessWire 'Hello world' demonstration module
5+
*
6+
* Demonstrates the Module interface and how to add hooks.
7+
*
8+
* See README file for further links regarding module development.
9+
*
10+
* This file is licensed under the MIT license
11+
* https://processwire.com/about/license/mit/
12+
*
13+
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
14+
* https://processwire.com
15+
*
16+
*/
17+
18+
class Helloworld extends WireData implements Module {
19+
20+
/**
21+
* getModuleInfo is a module required by all modules to tell ProcessWire about them
22+
*
23+
* @return array
24+
*
25+
*/
26+
public static function getModuleInfo() {
27+
28+
return array(
29+
30+
// The module'ss title, typically a little more descriptive than the class name
31+
'title' => 'Hello World',
32+
33+
// version number
34+
'version' => 3,
35+
36+
// summary is brief description of what this module is
37+
'summary' => 'An example module used for demonstration purposes.',
38+
39+
// Optional URL to more information about the module
40+
'href' => 'https://processwire.com',
41+
42+
// singular=true: indicates that only one instance of the module is allowed.
43+
// This is usually what you want for modules that attach hooks.
44+
'singular' => true,
45+
46+
// autoload=true: indicates the module should be started with ProcessWire.
47+
// This is necessary for any modules that attach runtime hooks, otherwise those
48+
// hooks won't get attached unless some other code calls the module on it's own.
49+
// Note that autoload modules are almost always also 'singular' (seen above).
50+
'autoload' => true,
51+
52+
// Optional font-awesome icon name, minus the 'fa-' part
53+
'icon' => 'smile-o',
54+
);
55+
}
56+
57+
/**
58+
* Initialize the module
59+
*
60+
* ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called
61+
* when ProcessWire's API is ready. As a result, this is a good place to attach hooks.
62+
*
63+
*/
64+
public function init() {
65+
66+
// add a hook after the $pages->save, to issue a notice every time a page is saved
67+
$this->pages->addHookAfter('save', $this, 'example1');
68+
69+
// add a hook after each page is rendered and modify the output
70+
$this->addHookAfter('Page::render', $this, 'example2');
71+
72+
// add a 'hello' method to every page that returns "Hello World"
73+
// use "echo $page->hello();" in your template file to display output
74+
$this->addHook('Page::hello', $this, 'example3');
75+
76+
// add a 'hello_world' property to every page that returns "Hello [user]"
77+
// use "echo $page->hello_world;" in your template file to display output
78+
$this->addHookProperty('Page::hello_world', $this, 'example4');
79+
}
80+
81+
/**
82+
* Example1 hooks into the pages->save method and displays a notice every time a page is saved
83+
*
84+
* @param HookEvent $event
85+
*
86+
*/
87+
public function example1($event) {
88+
/** @var Page $page */
89+
$page = $event->arguments[0];
90+
$this->message("Hello World! You saved {$page->path}.");
91+
}
92+
93+
94+
/**
95+
* Example2 hooks into every page after it's rendered and adds "Hello World" text at the bottom
96+
*
97+
* @param HookEvent $event
98+
*
99+
*/
100+
public function example2($event) {
101+
102+
/** @var Page $page */
103+
$page = $event->object;
104+
105+
// don't add this to the admin pages
106+
if($page->template == 'admin') return;
107+
108+
// add a "Hello World" paragraph right before the closing body tag
109+
$event->return = str_replace("</body>", "<p>Hello World!</p></body>", $event->return);
110+
}
111+
112+
/**
113+
* Example3 adds a 'hello' method (not property) to every page that simply returns "Hello World"
114+
*
115+
* @param HookEvent $event
116+
*
117+
*/
118+
public function example3($event) {
119+
$event->return = "Hello World";
120+
}
121+
122+
/**
123+
* Example 4 adds a 'hello_world' property (not method) to every page that returns "Hello [user]"
124+
*
125+
* @param HookEvent $event
126+
*
127+
*/
128+
public function example4($event) {
129+
$event->return = "Hello " . $this->user->name;
130+
}
131+
132+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
This InputfieldCKEditor directory is here to provide optional extra configuration options
2+
and plugins to the CKEditor Inputfield module.
3+
4+
5+
plugins/
6+
========
7+
Directory to place additional CKEditor plugins in. You can then activate them
8+
from your CKEditor field settings.
9+
10+
11+
contents.css
12+
============
13+
Example CSS file for the admin editor. To make CKEditor use this file, go to your CKEditor
14+
field settings and specify /site/modules/InputfieldCKEditor/contents.css as the regular
15+
mode Contents CSS file.
16+
17+
18+
contents-inline.css
19+
===================
20+
Same as contents.css but for the inline mode editor.
21+
22+
23+
mystyles.js
24+
===========
25+
Optional configuration for the CKEditor Styles option. To use this file, go to your
26+
CKEditor field settings and set the Custom Styles Set to be this file.
27+
28+
29+
config.js
30+
=========
31+
Custom config file used by all CKEditor instances (except instances configured by their
32+
own custom config file, see below...)
33+
34+
35+
config-body.js
36+
==============
37+
Example of field-specific custom config file. This one applies to a field named "body".
38+
Note that these config settings can also be specified directly in your CKEditor field
39+
settings in the admin, which many may prefer.
40+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* CKEditor field-specific (body) custom config file for ProcessWire
3+
*
4+
* Use this file to specify additional config options to a field named "body".
5+
* This is here just for example purposes. If you wanted to create a config
6+
* specific to some other field, like "sidebar", you would create another file
7+
* exactly like this named: config-sidebar.js
8+
*
9+
* If you wanted to use the same config.js for all of your CKEditor fields,
10+
* you would remove this file and just use the config.js file instead. Meaning,
11+
* this file completely overrides config.js if the field being edited is named
12+
* "body". The regular config.js file is not loaded when this one is loaded.
13+
*
14+
*/
15+
16+
/**
17+
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
18+
* For licensing, see LICENSE.html or http://ckeditor.com/license
19+
*/
20+
21+
CKEDITOR.editorConfig = function( config ) {
22+
// Define changes to default configuration here. For example:
23+
// config.uiColor = '#AADC6E';
24+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* CKEditor custom config file for ProcessWire
3+
*
4+
* Use this file to specify additional config options to all CKEditor instances,
5+
* except those that have field-specific config files, i.e. config-body.js for
6+
* config specific to a field named "body".
7+
*
8+
*/
9+
10+
/**
11+
* @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
12+
* For licensing, see LICENSE.html or http://ckeditor.com/license
13+
*/
14+
15+
CKEDITOR.editorConfig = function( config ) {
16+
// Define changes to default configuration here. For example:
17+
// config.uiColor = '#AADC6E';
18+
};

0 commit comments

Comments
 (0)