@bigbinary/neeto-image-uploader-frontend 1.2.6 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,188 @@
1
1
  # neeto-image-uploader
2
2
 
3
+ **neeto-image-uploader-nano** enables the management of assets across projects for an induvidual organization.
4
+
5
+ # Index
6
+
7
+ - [General information](#general-information)
8
+ - [Installation instructions](#installation-instructions)
9
+ - [Engine Installation](#engine-installation)
10
+ - [Frontend package Installation](#frontend-package-installation)
11
+ - [Components](#components)
12
+ - [1. AssetLibrary](#1-assetlibrary)
13
+ - [2. ImageUploader](#2-imageuploader)
14
+ - [Development instructions](#development-instructions)
15
+ - [Engine development](#engine-development)
16
+ - [Frontend package development](#frontend-package-development)
17
+ - [Setup](#setup)
18
+
19
+
20
+ # General information
21
+
22
+ - This nano deals with accessing assets across projects for an organization.
23
+
24
+ # Installation instructions
25
+
26
+ ## Engine Installation
27
+
28
+ 1. Add the following line to your application's Gemfile:
29
+
30
+ ```ruby
31
+ source "NEETO_GEM_SERVER_URL" do
32
+ # ..existing gems
33
+
34
+ gem 'neeto-image-uploader-engine'
35
+ end
36
+ ```
37
+
38
+ 2. Add the following two lines to the applications `Gemfile.rb` file:
39
+
40
+ ```ruby
41
+ gem "imagekitio"
42
+
43
+ gem "httparty"
44
+ ```
45
+
46
+ 3. Run the following command to install the engine:
47
+
48
+ ```shell
49
+ bundle install
50
+ ```
51
+
52
+ 4. Add the following line to your application's `config/routes.rb`:
53
+
54
+ ```ruby
55
+ mount NeetoImageUploaderEngine::Engine => "/neeto_image_uploader_engine"
56
+ ```
57
+
58
+ 5. Add the following keys to environment variables (all 6 keys are required):
59
+
60
+ ```zsh
61
+ IMAGE_KIT_PUBLIC_KEY
62
+ IMAGE_KIT_PRIVATE_KEY
63
+ IMAGE_KIT_URL_ENDPOINT
64
+ IMAGE_KIT_AUTH_ENDPOINT
65
+ IMAGE_KIT_DEFAULT_FOLDER
66
+
67
+ UNSPLASH_ACCESS_KEY #(for fetching images from unsplash)
68
+ ```
69
+
70
+ 6. Add the following lines to `secrets.yml`:
71
+
72
+ ```yml
73
+ image_kit_public_key: <%= ENV["IMAGE_KIT_PUBLIC_KEY"] %>
74
+ image_kit_private_key: <%= ENV["IMAGE_KIT_PRIVATE_KEY"] %>
75
+ image_kit_url_endpoint: <%= ENV["IMAGE_KIT_URL_ENDPOINT"] %>
76
+ image_kit_auth_endpoint: <%= ENV["IMAGE_KIT_AUTH_ENDPOINT"] %>
77
+ client_app_name: <%= ENV["CLIENT_APP_NAME"] %>
78
+ unsplash_access_key: <%= ENV["UNSPLASH_ACCESS_KEY"] %>
79
+ ```
80
+
81
+ 7. Add the folowing linse in `application_helper.rb` inside `app/helpers` folder:
82
+
83
+ ```ruby
84
+ module ApplicationHelper
85
+ def get_client_props
86
+ global_props = NeetoCommonsBackend::Helpers.common_client_props(@organization, current_user)
87
+
88
+ image_kit_props = {
89
+ image_kit: {
90
+ url_endpoint: Rails.application.secrets.image_kit_url_endpoint,
91
+ public_key: Rails.application.secrets.image_kit_public_key,
92
+ authentication_endpoint: Rails.application.secrets.image_kit_auth_endpoint,
93
+ folder: Rails.application.secrets.client_app_name
94
+ }
95
+ }
96
+
97
+ global_props.deep_merge!(
98
+ {
99
+ organization: {
100
+ subdomain: @organization.subdomain
101
+ }
102
+ }) # only required if organization subdomain information is not present in globalProps
103
+
104
+ global_props.deep_merge!(image_kit_props)
105
+ end
106
+ end
107
+ ```
108
+
109
+ 8. Add the following file `imagekitio.rb` inside `config/initializers`
110
+
111
+ ```ruby
112
+ # frozen_string_literal: true
113
+
114
+ ImageKitIo.configure do |config|
115
+ config.public_key = Rails.application.secrets.image_kit_public_key
116
+ config.private_key = Rails.application.secrets.image_kit_private_key
117
+ config.url_endpoint = Rails.application.secrets.image_kit_url_endpoint
118
+ end
119
+ ```
120
+
121
+ ## Frontend package installation
122
+
123
+ Install the latest neeto-image-uploader-frontend package using the below command:
124
+
125
+ ```shell
126
+ yarn add @bigbinary/neeto-image-uploader-frontend
127
+ ```
128
+
129
+ The frontend exports two components `AssetLibrary` and `ImageUploader`.
130
+
131
+ # Components
132
+
133
+ ## 1. AssetLibrary
134
+
135
+ <div align="center">
136
+ <img src="https://github.com/bigbinary/neeto-editor/assets/70290286/90f445f5-ed28-4e25-8e20-033887f06039" alt="Asset library"/>
137
+ </div>
138
+
139
+ ## 2. ImageUploader
140
+
141
+ <div align="center">
142
+ <img src="https://github.com/bigbinary/neeto-editor/assets/70290286/d293d887-38fd-4e55-a53d-dd591a52f053" alt="Image Uploader"/>
143
+ </div>
144
+
145
+ # Development instructions
146
+
147
+ ## Engine development
148
+
149
+ 1. Add this line to your application's Gemfile (replace the path to the local
150
+ copy of neeto-image-uploader-engine):
151
+
152
+ ```ruby
153
+ gem 'neeto-image-uploader-engine', path: '../neeto-image-uploader-engine'
154
+ ```
155
+
156
+ 2. And then execute:
157
+
158
+ ```shell
159
+ bundle install
160
+ ```
161
+
162
+ 3. Refer [engine installation](#engine-installation).
163
+
164
+ ## Frontend package development
165
+
166
+ The usage of `yalc` is explained in this video:
167
+ <https://www.youtube.com/watch?v=QBiYGP0Rhe0>
168
+
169
+ 1. See the changes in the host app by executing the following command \
170
+ <br/> Use this command if releasing package for the first time.
171
+
172
+ ```shell
173
+ yarn build && yalc publish
174
+ ```
175
+
176
+ Use this command to see changes after the initial publish.
177
+
178
+ ```shell
179
+ yarn release
180
+ ```
181
+
3
182
  ### Setup
4
183
 
5
184
  1. Setup and run the Rails server of the dummy application:
185
+
6
186
  ```zsh
7
187
  ./test/dummy/bin/setup
8
188
 
@@ -10,7 +190,8 @@ rails server
10
190
  ```
11
191
 
12
192
  2. Setup and run the example app:
193
+
13
194
  ```zsh
14
195
  yarn install
15
- yarn start
196
+ ./bin/webpacker-dev-server
16
197
  ```