added ability to mark recipes as private

This commit is contained in:
vabene1111
2022-07-13 15:46:39 +02:00
parent 51076d4ced
commit e91790f5ac
10 changed files with 224 additions and 56 deletions

View File

@ -188,10 +188,31 @@
</b-form-checkbox>
<br/>
<label for="id_name"> {{ $t("Imported_From") }}</label>
<label> {{ $t("Imported_From") }}</label>
<b-form-input v-model="recipe.source_url">
</b-form-input>
<br/>
<label> {{ $t("Private_Recipe") }}</label>
<b-form-checkbox v-model="recipe.private">
{{ $t('Private_Recipe_Help') }}
</b-form-checkbox>
<br/>
<label> {{ $t("Share") }}</label>
<generic-multiselect
@change="recipe.shared = $event.val"
parent_variable="recipe.shared"
:initial_selection="recipe.shared"
:label="'username'"
:model="Models.USER_NAME"
style="flex-grow: 1; flex-shrink: 1; flex-basis: 0"
v-bind:placeholder="$t('Share')"
:limit="25"
></generic-multiselect>
</b-collapse>
</div>
</div>
@ -723,6 +744,7 @@ import GenericModalForm from "@/components/Modals/GenericModalForm"
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import _debounce from "lodash/debounce";
import GenericMultiselect from "@/components/GenericMultiselect";
// use
Vue.use(mavonEditor)
@ -731,7 +753,7 @@ Vue.use(BootstrapVue)
export default {
name: "RecipeEditView",
mixins: [ResolveUrlMixin, ApiMixin],
components: {Multiselect, LoadingSpinner, draggable, GenericModalForm},
components: {Multiselect, LoadingSpinner, draggable, GenericModalForm, GenericMultiselect},
data() {
return {
recipe_id: window.RECIPE_ID,

View File

@ -68,6 +68,10 @@
"Enable_Amount": "Enable Amount",
"Disable_Amount": "Disable Amount",
"Ingredient Editor": "Ingredient Editor",
"Private_Recipe": "Private Recipe",
"Private_Recipe_Help": "Recipe is only shown to you and people its shared with.",
"Add_Step": "Add Step",
"Keywords": "Keywords",
"Books": "Books",

View File

@ -8,7 +8,7 @@ axios.defaults.xsrfHeaderName = "X-CSRFTOKEN"
export function apiLoadRecipe(recipe_id) {
let url = resolveDjangoUrl('api:recipe-detail', recipe_id)
if (window.SHARE_UID !== undefined) {
if (window.SHARE_UID !== undefined && window.SHARE_UID !== 'None') {
url += '?share=' + window.SHARE_UID
}

View File

@ -2023,6 +2023,12 @@ export interface RecipeBookFilter {
* @interface RecipeFile
*/
export interface RecipeFile {
/**
*
* @type {number}
* @memberof RecipeFile
*/
id?: number;
/**
*
* @type {string}
@ -2031,16 +2037,16 @@ export interface RecipeFile {
name: string;
/**
*
* @type {any}
* @type {string}
* @memberof RecipeFile
*/
file?: any;
file_download?: string;
/**
*
* @type {number}
* @type {string}
* @memberof RecipeFile
*/
id?: number;
preview?: string;
}
/**
*
@ -3540,18 +3546,6 @@ export interface UserPreference {
* @memberof UserPreference
*/
use_kj?: boolean;
/**
*
* @type {string}
* @memberof UserPreference
*/
search_style?: UserPreferenceSearchStyleEnum;
/**
*
* @type {boolean}
* @memberof UserPreference
*/
show_recent?: boolean;
/**
*
* @type {Array<CustomFilterShared>}
@ -3690,15 +3684,6 @@ export enum UserPreferenceDefaultPageEnum {
Plan = 'PLAN',
Books = 'BOOKS'
}
/**
* @export
* @enum {string}
*/
export enum UserPreferenceSearchStyleEnum {
Small = 'SMALL',
Large = 'LARGE',
New = 'NEW'
}
/**
*
@ -4713,7 +4698,40 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
};
},
/**
* function to retrieve a recipe from a given url or source string :param request: standard request with additional post parameters - url: url to use for importing recipe - data: if no url is given recipe is imported from provided source data - (optional) bookmarklet: id of bookmarklet import to use, overrides URL and data attributes :return: JsonResponse containing the parsed json, original html,json and images
* function to handle files passed by application importer
* @param {any} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createimportFiles: async (body?: any, options: any = {}): Promise<RequestArgs> => {
const localVarPath = `/api/import/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* function to retrieve a recipe from a given url or source string :param request: standard request with additional post parameters - url: url to use for importing recipe - data: if no url is given recipe is imported from provided source data - (optional) bookmarklet: id of bookmarklet import to use, overrides URL and data attributes :return: JsonResponse containing the parsed json and images
* @param {any} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -11014,7 +11032,17 @@ export const ApiApiFp = function(configuration?: Configuration) {
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* function to retrieve a recipe from a given url or source string :param request: standard request with additional post parameters - url: url to use for importing recipe - data: if no url is given recipe is imported from provided source data - (optional) bookmarklet: id of bookmarklet import to use, overrides URL and data attributes :return: JsonResponse containing the parsed json, original html,json and images
* function to handle files passed by application importer
* @param {any} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createimportFiles(body?: any, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createimportFiles(body, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
* function to retrieve a recipe from a given url or source string :param request: standard request with additional post parameters - url: url to use for importing recipe - data: if no url is given recipe is imported from provided source data - (optional) bookmarklet: id of bookmarklet import to use, overrides URL and data attributes :return: JsonResponse containing the parsed json and images
* @param {any} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -13042,7 +13070,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
return localVarFp.createViewLog(viewLog, options).then((request) => request(axios, basePath));
},
/**
* function to retrieve a recipe from a given url or source string :param request: standard request with additional post parameters - url: url to use for importing recipe - data: if no url is given recipe is imported from provided source data - (optional) bookmarklet: id of bookmarklet import to use, overrides URL and data attributes :return: JsonResponse containing the parsed json, original html,json and images
* function to handle files passed by application importer
* @param {any} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createimportFiles(body?: any, options?: any): AxiosPromise<any> {
return localVarFp.createimportFiles(body, options).then((request) => request(axios, basePath));
},
/**
* function to retrieve a recipe from a given url or source string :param request: standard request with additional post parameters - url: url to use for importing recipe - data: if no url is given recipe is imported from provided source data - (optional) bookmarklet: id of bookmarklet import to use, overrides URL and data attributes :return: JsonResponse containing the parsed json and images
* @param {any} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
@ -14958,7 +14995,18 @@ export class ApiApi extends BaseAPI {
}
/**
* function to retrieve a recipe from a given url or source string :param request: standard request with additional post parameters - url: url to use for importing recipe - data: if no url is given recipe is imported from provided source data - (optional) bookmarklet: id of bookmarklet import to use, overrides URL and data attributes :return: JsonResponse containing the parsed json, original html,json and images
* function to handle files passed by application importer
* @param {any} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ApiApi
*/
public createimportFiles(body?: any, options?: any) {
return ApiApiFp(this.configuration).createimportFiles(body, options).then((request) => request(this.axios, this.basePath));
}
/**
* function to retrieve a recipe from a given url or source string :param request: standard request with additional post parameters - url: url to use for importing recipe - data: if no url is given recipe is imported from provided source data - (optional) bookmarklet: id of bookmarklet import to use, overrides URL and data attributes :return: JsonResponse containing the parsed json and images
* @param {any} [body]
* @param {*} [options] Override http request option.
* @throws {RequiredError}