Procházet zdrojové kódy

feat: added border helpers | feat: added artist endpoint | feat: added episode endpoint

tags/0.9.0
J před 6 roky
rodič
revize
b1f845d750

+ 6
- 2
plugins/cia-endpoints/cia-end-points.php Zobrazit soubor

38
  * Craft in America custom post_types
38
  * Craft in America custom post_types
39
  */
39
  */
40
 add_action( 'rest_api_init', function () {
40
 add_action( 'rest_api_init', function () {
41
-    $media_controller = new Make_Endpoint_For('customtype');
42
-    $media_controller->register_custom_route('custometypes');
41
+    $media_controller = new Make_Endpoint_For('episode');
42
+    $media_controller->register_custom_route('episodes');
43
 });
43
 });
44
+add_action( 'rest_api_init', function () {
45
+    $media_controller = new Make_Endpoint_For('artist');
46
+    $media_controller->register_custom_route('artists');
47
+});

+ 3
- 3
plugins/includes/custom-types.php Zobrazit soubor

1
 <?php
1
 <?php
2
     function get_all_custom_types() {
2
     function get_all_custom_types() {
3
         return array(
3
         return array(
4
-            'customtype',
5
-            // 'artist',
6
-            // 'episode',
4
+            // 'customtype',
5
+            'artist',
6
+            'episode',
7
             // 'short',
7
             // 'short',
8
             // 'talk',
8
             // 'talk',
9
             // 'object',
9
             // 'object',

+ 5
- 0
vue-theme/functions.php Zobrazit soubor

154
 remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
154
 remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
155
 remove_action( 'wp_print_styles', 'print_emoji_styles' );
155
 remove_action( 'wp_print_styles', 'print_emoji_styles' );
156
 remove_action( 'admin_print_styles', 'print_emoji_styles' );
156
 remove_action( 'admin_print_styles', 'print_emoji_styles' );
157
+// REMOVE block CSS
158
+function webapptiv_remove_block_library_css() {
159
+    wp_dequeue_style( 'wp-block-library' );
160
+}
161
+add_action( 'wp_enqueue_scripts', 'webapptiv_remove_block_library_css' );
157
 
162
 
158
 // header( 'Access-Control-Allow-Origin: http://localhost:8080' );
163
 // header( 'Access-Control-Allow-Origin: http://localhost:8080' );
159
 header( 'Content-Type: application/json' );
164
 header( 'Content-Type: application/json' );

+ 7
- 0
vue-theme/src/app.vue Zobrazit soubor

46
             padding: $ms
46
             padding: $ms
47
             align-items: flex-start
47
             align-items: flex-start
48
             
48
             
49
+            .shadow
50
+                box-shadow: rgb(34, 36, 37) 0px 0px 4px 0px
51
+            .b-radius
52
+                border-radius:5px
53
+                
49
             /* Content Pieces */
54
             /* Content Pieces */
50
             .post
55
             .post
51
                 background-color: teal
56
                 background-color: teal
59
                         color: white
64
                         color: white
60
                     .wp-block-image
65
                     .wp-block-image
61
                         margin: 0
66
                         margin: 0
67
+                        img
68
+                            width: 100%
62
                 > ul
69
                 > ul
63
                     list-style: none
70
                     list-style: none
64
             
71
             

+ 2
- 2
vue-theme/src/pages/index.vue Zobrazit soubor

1
 // Homepage grid
1
 // Homepage grid
2
 <template lang="pug">
2
 <template lang="pug">
3
 .page--index.f-row.between
3
 .page--index.f-row.between
4
-    article.f-grow
4
+    article.f-grow.shadow.b-radius
5
         header
5
         header
6
             h1 {{ site }}: index
6
             h1 {{ site }}: index
7
         section(v-if="allPagesLoaded")
7
         section(v-if="allPagesLoaded")
20
             p icon
20
             p icon
21
 
21
 
22
     //- COMPONENT: Make this with a prop
22
     //- COMPONENT: Make this with a prop
23
-    aside
23
+    aside.shadow.b-radius
24
         header
24
         header
25
             h4 this is some other stuff
25
             h4 this is some other stuff
26
         section(v-if="allPostsLoaded")
26
         section(v-if="allPostsLoaded")

+ 9
- 1
vue-theme/src/sss/_helpers.sss Zobrazit soubor

24
     &-col
24
     &-col
25
         flex-direction: column
25
         flex-direction: column
26
     &-grow
26
     &-grow
27
-        flex-grow: 1
27
+        flex-grow: 1
28
+
29
+.b
30
+    &-radius
31
+        border-radius: 5px
32
+    &-none
33
+        border: none
34
+    &-solid
35
+        border: #000000 1px solid

+ 46
- 0
vue-theme/src/store/modules/artist.js Zobrazit soubor

1
+import api from '../../utils/api'
2
+
3
+const state = {
4
+    all: {},
5
+    loaded: false,
6
+    artist: null,
7
+}
8
+
9
+const getters = {
10
+    allArtists: state => state.all,
11
+    allArtistsLoaded: state => state.loaded,
12
+    artist: state => id => {
13
+        let field = typeof id === 'number' ? 'id' : 'slug'
14
+        let artist = state.all.filter(artist => artist[field] === id)
15
+        return (artist[0]) ? artist[0] : false
16
+    },
17
+    artistContent: state => id => {
18
+        let field = typeof id === 'number' ? 'id' : 'slug'
19
+        let artist = state.all.filter(artist => artist[field] === id)
20
+
21
+        return (artist[0]) ? artist[0].content.rendered : false
22
+    },
23
+    someArtists: state => limit => {
24
+        if (state.all.length < 1) return false
25
+
26
+        let all = [...state.all]
27
+
28
+        return all.splice(0, Math.min(limit, state.all.length))
29
+    },
30
+}
31
+
32
+const actions = {
33
+    getAllArtists({ commit }) {
34
+        api.getByType('artists', artists => {
35
+            commit('STORE_FETCHED_ARTISTS', { artists })
36
+            commit('ARTISTS_LOADED', true)
37
+        })
38
+    }
39
+}
40
+
41
+const mutations = {
42
+    STORE_FETCHED_ARTISTS(state, { artists }) { state.all = artists },
43
+    ARTISTS_LOADED(state, val) { state.loaded = val },
44
+}
45
+
46
+export default { state, getters, actions, mutations }

+ 46
- 0
vue-theme/src/store/modules/episode.js Zobrazit soubor

1
+import api from '../../utils/api'
2
+
3
+const state = {
4
+    all: {},
5
+    loaded: false,
6
+    episode: null,
7
+}
8
+
9
+const getters = {
10
+    allEpisodes: state => state.all,
11
+    allEpisodesLoaded: state => state.loaded,
12
+    episode: state => id => {
13
+        let field = typeof id === 'number' ? 'id' : 'slug'
14
+        let episode = state.all.filter(episode => episode[field] === id)
15
+        return (episode[0]) ? episode[0] : false
16
+    },
17
+    episodeContent: state => id => {
18
+        let field = typeof id === 'number' ? 'id' : 'slug'
19
+        let episode = state.all.filter(episode => episode[field] === id)
20
+
21
+        return (episode[0]) ? episode[0].content.rendered : false
22
+    },
23
+    someEpisodes: state => limit => {
24
+        if (state.all.length < 1) return false
25
+
26
+        let all = [...state.all]
27
+
28
+        return all.splice(0, Math.min(limit, state.all.length))
29
+    },
30
+}
31
+
32
+const actions = {
33
+    getAllEpisodes({ commit }) {
34
+        api.getByType('episodes', episodes => {
35
+            commit('STORE_FETCHED_EPISODES', { episodes })
36
+            commit('EPISODES_LOADED', true)
37
+        })
38
+    }
39
+}
40
+
41
+const mutations = {
42
+    STORE_FETCHED_EPISODES(state, { episodes }) { state.all = episodes },
43
+    EPISODES_LOADED(state, val) { state.loaded = val },
44
+}
45
+
46
+export default { state, getters, actions, mutations }

Načítá se…
Zrušit
Uložit